using a tag to replace div [closed]
my site has 2 pages both have hyperlinks to each other but when user click on that hyperlink I just need a certain div of that page to be replaced by certain div on other page, please guide me how to program it.
structure
page1.html
<div id="no_replace">
<a href="page2.html">page 2</a>
<div id="replace">
//page one stuff
</div>
</div>
page2.html
<div id="no_replace">
<a href="page1.html">page 1</a>
<div id="replace">
//page two stuff
</div>
</div>
so on page one when usr clicks on link "page two" ... I want the 'rep开发者_开发百科lace' div of page one to be replaced by 'replace' div of page2.html
you need to use javascript to trigger an event where the content of the div is replace when the button is clicks. Learn some javascript from w3schools.
<script type="text/javascript">
function dosomething(){
//replace div content here
}
</script>
<a href="somelink" onclick="dosomething();">
精彩评论