简体   繁体   English

在保留在同一页面上的同时单击按钮来运行不同的代码?

[英]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=******&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中加载新的新代码的按钮:

<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. 使用纯JavaScript,将以下代码添加到您的按钮onclick事件。

document.getElementById("1").innerHTML = "your code"; document.getElementById(“ 1”)。innerHTML =“您的代码”;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击一个按钮在PHP中运行casperJS并使用按钮在相同的PHP页面中回显结果 - Clicking a button to run casperJS in PHP and echo results in same PHP page with button 如何在html页面上单击按钮执行python代码,并在Django的同一页面上显示结果? - How to execute a python code on clicking a button on html page and show the results on the same page in Django? 单击提交按钮后停留在同一页面上 - Staying on same page after clicking submit button 单击一个按钮并在同一页面上显示javascript函数 - Clicking a button and displaying a javascript function on same page 如何通过单击下一步按钮使用Angular js转到具有不同数据的同一页面到laravel - how to go to same page with different data into laravel using angular js by clicking next button 在按钮内运行代码而无需单击它 - Run code inside a button without clicking it 单击链接将其显示在同一页面上的不同Div中 - Clicking a link display it in Different Div on Same Page 单击Wordpress管理页面表单中的“提交”按钮时,JavaScript代码无法运行 - JavaScript code not run when clicking submit button in Wordpress admin page form 单击“后退”按钮并登陆到具有超时重定向的页面上 - Clicking the back button and landing on a page with a timeout redirect to the same page <button>相同的按钮,多个位置,不同的代码</button> - <button> Same Button, Multiple Locations, Different Code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM