开发者

IFrame causing javascript code to not execute

开发者 https://www.devze.com 2022-12-25 12:40 出处:网络
Does anyone know why this code doesn\'t work. This means, the alert is NOT fired <iframe/> <script type=\"text/javascript\">alert(\'hello\');</script>

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. 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.


You need to close the <iframe> tag like this:

<iframe></iframe>
<script type="text/javascript">alert('hello');</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消