Setting a button in html - html

How do I set up a link button in html?
I want to set a button from the homepage so that user may be viewed by a log in screen. I have two index.html files, one for the homepage, and one for the login screen. How do I set it so when users click on log in they will be presented with the login screen.
I tried <li>Sign Up/lOG IN</li>.
My goal was to use href= location of index.html.
When I click the link it takes me to an error page. The top link would be the address to the index file that has the login html.

You don't have .html on your url. Try:
<li>Sign Up/lOG IN</li>
Also, you are using a relative link, so the position of the file where you have this link is important. Right now it will look one directory up for a file named index.html. If the file with the link is foo.html make sure in the same folder you have a folder named login that has a file named index.html.

Related

How to change href for homepage to work regardless of current HTML file location

I've created the side menu bar of my website in a separate html file that uses jquery to import it to my website's pages. I ran into a problem where I have some html files in a separate folder causing the homepage button link to not work due to it being in a different relative file path:
<li>Home</li>
How can I make this href path universal so regardless of the current html file's location, it will always go to my Homepage.htm which is located in the root of my project file.

Html File path to subfolder

Using atom code editor I have a folder "login". I also have a subfolder "register".
I can access the login.html in my browser from a button on the index.html. However, once I am on the login.html, I can not get to register.html
Once I try to access the register page from a button on my login page in my browser I am given the following:
/myproject/Login/Login/Register/register.html
If I remove one of the /login I am given the page I want. Not sure why my file path is not directly working from the button on my login.html
<a class="txt2" href="Login/Register/register.html">
I had to change to
<a class="txt2" href="../Login/Register/register.html">

JSF 2.2: catch click on link of dynamically included html file

I my JSF view I display a list of links. When the user clicks on the list of links, two HTML files are loaded into a ui:include element from the folder on the server that the clicked link points to.
E.g. clicking the link:
http://localhost:7474/project/folder1
Loads the menu.html file from that folder into a ui:insert element as well as a file called cov.html into another ui:insert.
The menu.html looks like this:
<ul id="menu" xmlns="http://www.w3.org/1999/xhtml" >
<li class="menulink">
ONE
<ul>
<li class="menulink">
TWO
<ul>
<li class="menulink">
THREE
</li>
</ul>
</li>
</ul>
</li>
</ul>
Clicking on the link ONE should load the file
http://localhost:7474/project/folder1/files/one.html
into the ui:insert where previously the file cov.html had been loaded into (thus, replace the cov.html file).
So any file pointed to by one of those links in the menu.html should be loaded into the ui:insert.
When I click on one of the links now, it looks for the file:
http://localhost:7474/project/files/one.html
How can I get the value of the link that was clicked in my backing bean and load the correct file into the ui:insert?
Not an option for me would be to put the name of the folder into the link of the menu.html file, e.g. I cannot do this:
ONE
because the files get uploaded by users in a zip folder and I want them to be able to name that folder anything they like. So I cannot hardcord that folder name in the menu.html.
Do the a elements need to have an attribute that the backing bean can access or could I somehow incerpect the requestes URL and correct it?
What would be the best way to handle this?

Linking from a subfolder back to the root folder index.html file

I am having trouble linking from a subfolder index file back to my root folder index file.
I have a logo in the nav bar of example.com/blog that I would like to have link back to example.com
I have tested various linking options for the logo image including
<a href="../index.html">
<a href="http://www.example.com">
<a href="../">
And none of them seem to work. The logo image continues to link to example.com/blog/index.html
The strange thing is that if I right click on the image and then select open in a new window/tab, then it will load example.com just fine.
I am at a complete loss.
Could this be something related to my .htaccess file?
Additional Info
I added a "Home" text link to the nav bar using the below syntax and it works perfectly.
Home
The image for some reason will not link back to the rootfolder index.html file using the same syntax. It keeps loading http://www.example.com/blog/index.html
Try using a javascript redirect
function home() {
window.location.replace("http://example.com");
}
<button onclick="home()">hi</button>
Replace http://example.com with your website.

Hiding .html extension in links

Say I have a link like this on public_html/index.html:
Link to picture
Since the "link to picture" has its own folder and uses index.html, normally that extension would be hidden if I type in "www.mywebsite.com/pictures". But if I first go to "www.mywebsite.com", then click that link, it would display in the address bar as "www.mywebsite.com/pictures/index.html". How would I hide the "index.html" in links? I've tried this but it doesn't work:
Link to picture <---this simply opens the file directory
Thanks.
Add the following to your httpd.conf file:
DirectoryIndex index.html
And by default if you don't pass in a filename index.html gets rendered instead of the directory content