我的代码中有一个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>
我想在同一页面上点击一个按钮,在同一个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>
答案 0 :(得分:1)
使用纯javascript,将以下代码添加到按钮onclick事件。
document.getElementById(“1”)。innerHTML =“your code”;