开发者

using a tag to replace div [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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();">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜