[英]IFrame causing javascript code to not execute
Does anyone know why this code doesn't work. 有谁知道为什么这段代码不起作用。 This means, the alert is NOT fired 这意味着,警报不会被触发
<iframe/>
<script type="text/javascript">alert('hello');</script>
While this code with the alert BEFORE the Iframe works perfeclty. 虽然此代码具有警报BEFORE iframe工作完美。 This means the alert is fired 这意味着警报被触发
<script type="text/javascript">alert('hello');</script>
<iframe/>
Seems that no javascript placed after the iframe is executed, I don't find any logic to this. 似乎在iframe执行后没有放置javascript,我没有找到任何逻辑。
You need to close the <iframe>
tag like this: 您需要关闭<iframe>
标记,如下所示:
<iframe></iframe>
<script type="text/javascript">alert('hello');</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.