簡體   English   中英

在保留在同一頁面上的同時單擊按鈕來運行不同的代碼?

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

我在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=******&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>

我想保留在同一頁面上,單擊在同一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&amp;autoplay=true" width="640" height="392" frameborder="no"></iframe>
</div>

使用純JavaScript,將以下代碼添加到您的按鈕onclick事件。

document.getElementById(“ 1”)。innerHTML =“您的代碼”;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM