Click here to Skip to main content
15,922,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to open another Html page in the same HTML page when a button is clicked using javascript

Explain with me an example?

Thank You
Posted

You have to user iframe for that...:)


HTML
<html>
<body>
This is first or root page

<iframe src="http://facebook.com">
  <p>Your browser does not support iframes.</p>
</iframe>

</body>
</html>
 
Share this answer
 
Try this JavaScript code:
JavaScript
document.getElementById("changeThisIdIntoTheIdOfYourButton").onclick = function() {
    window.location.href = "yourNewPage.html";
};
 
Share this answer
 
<a href="somelink" target="_parent">click here</a>

http://www.w3schools.com/jsref/prop_anchor_target.asp[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900