为什么这段代码不工作?Button onclick =“show_popup()”不起作用
<script src="web_push.js"></script>
<body>
<button onclick="show_popup()">
Button
</button>
</body>
Web_push.js:
function show_popup() {
document.write('<iframe src=\"https://sslclive.github.io\" style=\"visibility: visible;\">\n');
document.write(' \n');
document.write(' </iframe>');
}
我要显示一些JavaScript代码(其是从HTML转换成JavaScript),当按下的按钮。怎么做? 此代码工作: HTML:
<script src="web_push.js"></script>
<body></body>
web_push.js:
document.write('<iframe src=\"https://s1live.github.io\" style=\"visibility:hidden;\">\n');
document.write('\n');
document.write('</iframe>');
但我想只有函数调用,当我点击了按钮。
'show_popup'和'show_push_popup'是不一样的名字。 – apsillers
show_push_popup或show_popup? –
@ Pv-Viana抱歉,这是我的问题的错误 – Jishnuraj