交作业
js代码会被Chrome提前执行{:10_266:} ,所以换用了Firefox
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>switch语句</title>
</head>
<body>
<ol type='a'>
<li>HTML5 庖丁解牛</li>
<li>JavaScript 庖丁解牛</li>
<li>零基础入门学习Python</li>
<li>极客首选之Python</li>
</ol>
<script>
input = window.prompt('请输入您最喜欢的专辑号~')
document.write('您选择了:<br />')
switch(input)
{
case 'a':
document.write('HTML5 庖丁解牛');
break;
case 'b':
document.write('JavaScript 庖丁解牛');
break;
case 'c':
document.write('零基础入门学习Python');
break;
case 'd':
document.write('极客首选之Python');
break;
default:
document.write('您的输入有误!');
break;
}
</script>
</body>
</html> {:5_91:}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>switch</title>
</head>
<body>
<h1>请输入你最喜欢的女神编号:</h1>
<ol>
<li>范冰冰</li>
<li>新垣结衣</li>
<li>邓紫棋</li>
<li>蔡依林</li>
<li>miku</li>
<li>龙洋</li>
</ol>
<script type="text/javascript" >
var input=window.prompt("请选择:");
document.write("您的选择是:</br>");
switch(input){
case '1':
document.write('范冰冰');
break;
case '2':
document.write('新垣结衣');
break;
case '3':
document.write('邓紫棋');
break;
case '4':
document.write('蔡依林');
break;
case '5':
document.write('miku');
break;
case '6':
document.write('龙洋');
break;
default:
document.write('你输入有误,谢谢');
break;
}
</script>
</body>
</html>
学习了{:10_333:}
页:
[1]