题目内容:
1.<html><head>
<script type="text/javascript" >
function closeWin(){
//在此处添加代码
// **********Found**********
if(________________("确定要退出吗?")){
// **********Found**********
________________;
}
}
function morning(){
now = new Date();
// **********Found**********
hour = _______________;
if (hour < 9){window.status="早上好!"}
else {window.status="下午好!";}}
</script>
</head>
<!-- **********Found********** -->
<body ________________="morning()">
<!-- **********Found********** -->
<input type="button" value="关闭窗口" onclick="______________"/>
</body>
</html>
本题的功能是:在早上9点前则在窗囗状态栏中显示“早上好”,否则显示“下午好”。点击页面中的按钮时,弹出对话框提示“确定要退出吗”,确定后自动关闭窗口。
2.<html>
<head>
<script>
function foo()
{
var str = reverse('a,b,c,d,e,f,g');
alert(str);
if (str == 'g,f,e,d,c,b,a')
alert('成功');
else alert('失败');
}
function reverse(str)
{
// 在此处加入代码,完成字符串翻转功能
// **********Found**********
var spl = str._____________(',');
var newstr="";
// **********Found**********
for(i=____________;i>=0;i--)
{
// **********Found**********
newstr+=____________+',';
}
// **********Found**********
newstr=newstr._____________(0,newstr.length-1)
return newstr;
}
</script>
</head>
<body>
<input type="button" value="str" onclick="foo()" />
</body>
</html>
本题的要求是:点击页面中的按钮,将'a,b,c,d,e,f,g'字符串输出为'g,f,e,d,c,b,a',弹出警告框显示"成功"。
参考答案:
答案解析: