HTML:超文本标记语言
CSS:结构化层叠样式
选择器{
属性名:属性值;
}
javascript:交互/特效
上机练习1
vararray=["America","Greece","Britain","Canada","China","Egypt"];
var count=0;
for(var i in array){
if(array[i].indexOf("a")>-1||array[i].indexOf("A")>-1){
count++;
}
}
document.write("包含a或A的字符有:"+count);
上机练习3
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>根据时间问好</title>
<script type="text/javascript">
function jisuan(){
var op1=prompt('请输入第一个数:');
var op2=prompt('请输入第二个数:');
var pex=prompt('请输入运算符号:');
op1=parseInt(op1);//字符串转成整数
op2=parseInt(op2);
switch(pex){
case '+':
alert("两数运算结果为:"+op1+pex+op2+"="+(op1+op2));
break;
case '-':
alert("两数运算结果为:"+op1+pex+op2+"="+(op1-op2));
break;
case '*':
alert("两数运算结果为:"+op1+pex+op2+"="+(op1*op2));
break;
case '/':
alert("两数运算结果为:"+op1+pex+op2+"="+(op1/op2));
break;
case '%':
alert("两数运算结果为:"+op1+pex+op2+"="+(op1%op2));
break;
}
}
</script>
</head>
<body>
<input type="button"value="计算两数运算结果"οnclick="jisuan()"/>
</body>
</html>