[英]Run different code clicking a button while remaining on same page?
I have in a div id="1" following code: 我在div id =“ 1”中输入以下代码:
<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=******&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=******&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中加载新的新代码的按钮:
<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&autoplay=true" width="640" height="392" frameborder="no"></iframe>
</div>
Using pure javascript, add the following code to your buttons onclick event. 使用纯JavaScript,将以下代码添加到您的按钮onclick事件。
document.getElementById("1").innerHTML = "your code"; document.getElementById(“ 1”)。innerHTML =“您的代码”;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.