标签:
hello.js
function hello(){ alert(‘hello‘); }
hello.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script id="hello" src="hello.js"></script> </head> <body> </body> <script> hello(); if (-[1,]) { document.getElementById(‘hello‘).remove(); } else { document.getElementById(‘hello‘).removeNode(true); } setTimeout(function(){ hello(); },1000); </script> </html>
会执行: Chrome,firefox,IE 11,Opera
不执行: Safari
暂时仅测试这些
js兼容性 - 动态删除script标签后 ,定义的函数是否执行
标签:
原文地址:http://www.cnblogs.com/j4s0n/p/5397292.html