User selection in Javascript?

- 1 answer

Ad

User selection in Javascript? So I have a folder, and in the folder I have 2 other folder one is about.html and the other is main.html........ So my question is if I m on my main html page and have my about in <ul><li>about<li><ul> And I want if I click on the about, I want it to go to the about.main html...... So basically I want to know how can I can about.html to my main.html so went I click it, it take me straight to my about page...... Hope somebody can help I m new to JavaScript so take it easy on meπŸ˜€

Ad

Answer

Ad

If I understand what you are saying why not just use an a tag eg.

<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="folder1/about.html">About</a>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="folder2/main.html">Main</a> 

You can do this in javascript like this

var link = document.createElement('a');
link.target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="folder1/about.html";
link.click();
Ad
source: stackoverflow.com
Ad