Jump to content

html


khushboo.singh

Recommended Posts

how to change the content of div tag by another html file externally using javascriptin my HTML file i want to cange content of div tag "hello freinds" with another file content i.e image.html without opening new tab<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Amazon</title><link rel="stylesheet" href="amazon.css" /> </head><body> <a href="http://www.microsoft.com" id="one" onMouseOver="return submenu('first','inline');" onMouseOut="return submenu('first','none');">Menu 1</a><br /> <a href="http://www.vnnotech.com" onMouseOver="return submenu('second','inline');" onMouseOut="return submenu('second','none');">Menu 2</a><br /> <a href="#" onclick="hi('third');" >Menu3</a> <div id="first"> This is first div </div> <div id="second"> This is second div </div> <div id="third"> hello friends </div><script>function submenu(item, visibility) {document.getElementById(item).style.display = visibility;return false;}function hi(item1){var newContent="http://localhost/project/image.html";document.getElementById(item1).innerHTML="image.html";return false;}</script></body></html>

Link to comment
Share on other sites

This isn't something you can do with javascript unfortunately. You will need to use a server side scripting language such as PHP or ASP to use includes.

 

The only way to do it without server side scripting languages would be with iframes, which I've done here: http://jsfiddle.net/RDay/DhUa8/

Link to comment
Share on other sites

how to change the content of div tag by another html file externally using javascriptin my HTML file i want to cange content of div tag "hello freinds" with another file content i.e image.html without opening new tab

 

???

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...