<Script language="javascript">
// JavaScript Appears here.
alert("欢迎你浏览网站!");
alert("我的网址是:www.google.net");
alert("资源之窗,了解服务的窗口!");
</Script>
<script type="text/javascript">
function show(str) {
// url是全局变量,函数正确执行
alert("my site: "+str);
}
function test() {
var url="www.google.cn";
setTimeout(function(){show(url);},5000);
}
test();
</script>
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)