I am working on a website and thought of reducing the number of pages by writing a bit of lines in javascript. I have a table on a page which leads you to 15 other pages. So I thought of opening one page that has all the info of the 15 pages combined and display the content depending on which link is click on the table. One of my table data is as under
<td><a style="color:black;" onClick="openCompiler()">C++ Compiler</a></td>
I am triggering an event call openCompiler()
when the link is clicked.
function openCompiler()
{
window.open("mypage.html")
document.getElementById(compiler).style.display="block";
}
In the page I have a wrapper(called compiler) which has no display initially but when the link is clicked , it opens the page and displays the wrapper (called compiler).
My above efforts have failed and am looking for another way as:
1) The window.open()
is not able to open an HTML file on my folder.
2 I am not sure if the document.getElementById(compiler).style.display="block";
is looking for the element called compiler in the current page.
What I am looking for:
1) A way to open another html page using javascript.
2) A way to set style of an element on the new page from the initial page(one with the table).
All help is appreciated :)