简体   繁体   中英

Run different code clicking a button while remaining on same page?

I have in a div id="1" following code:

<div id="1" style="margin-left: 0px; padding: 0px; float: left; width: 640px; height: 392px; border: 0px;">
  <object width="640" height="392" classid="clsid:**************">
    <param name="flashvars" value="cid=******&amp;autoplay=true" />
    <param name="allowfullscreen" value="true" />
    <param name="allowscriptaccess" value="always" />
    <param name="src" value="http://www.ustream.tv/flash/viewer.swf" />
    <embed flashvars="cid=******&amp;autoplay=true" width="640" height="392" allowfullscreen="true" allowscriptaccess="always" src="http://www.ustream.tv/flash/viewer.swf" type="application/x-shockwave-flash"></embed>
  </object>
</div>

I want remaining on same page click a button loading in same div a new different code :

<div id="1" style="margin-left: 0px; padding: 0px; float: left; width: 640px; height: 392px; border: 0px;">
  <iframe style="border: 0 none transparent;" src="//www.ustream.tv/embed/******?wmode=direct&amp;autoplay=true" width="640" height="392" frameborder="no"></iframe>
</div>

Using pure javascript, add the following code to your buttons onclick event.

document.getElementById("1").innerHTML = "your code";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM