为甚,没反应
function openWindow()
{
var aa;
aa=prompt("确定打开吗?");
}
openWindow(); //你少了这个语句,是调用的
你只是定义了函数而没有调用,所以没反应 !!
function openWindow()
{
var aa;
aa=prompt("确定打开吗?");
}
openWindow(); //这个是调用方法是语句
<script type="text/javascript">
function openWindow(){
var aa;
aa=prompt("dfdfd")
}
openWindow();
</script>
//这个是有反应的 ,你可以试试
<!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow() { var aa; aa=prompt("确定打开吗?"); } openWindow(); </script> </head> </html>
你定义了函数不调用,怎么会有反应。。。还有html基本的结构不能少吧。。。