<html>
<head bgColor="BLUE"><b>这是头部<b></head>
<body bgColor="WHITE">
<p>Paragraph 1</p>
<script type="text/javascript">
document.bgColor="WHITE";
alert("First Script Block");
</script>
<p>Paragraph 2</p>
<script language="JavaScript" type="text/javascript">
//alert("Second Script Block");
//document.bgColor="Blue";
//var degFahren = Number(prompt("Enter the degress is in Fahrenheit",50));
//if(degFahren < 50)
// alert("degFahren < 50");
//else
// alert("degfahren >= 50");
/*var numb = parseInt(prompt("pick a Number 1 between 5 ",""));
switch(numb)
{
case 1:
document.write("number 1");
break;
case 2:
document.write("number 2");
break;
case 3:
document.write("number 3");
break;
default:
document.write("notj");
}*/
//ceil
var vl = 9.01;
alert("ceil vl = "+vl+"\n ceil(vl) "+Math.ceil(vl));
//ceil
document.bgColor="WHITE";
var myArrays = new Array("1",'2','3','4','5',6);
var loopCount;
for(loopCount = 0; loopCount < 5; loopCount++){
document.write(myArrays[loopCount]+"<br>");
}
var fromChar="";
var charCode;
for(charCode = 65;charCode<90;charCode++){
document.write(fromChar+String.fromCharCode(charCode));
}
document.write("<br>");
fromChar = String.fromCharCode(89);
document.write(fromChar);
document.write("<br>");
var elmentIndex;
for(elmentIndex in myArrays){
document.write("myArrays["+elmentIndex+"]= "+myArrays[elmentIndex]+"<br>");
}
var age = prompt("please enter you age");
while(isNaN(age) == true){
age = prompt("please enter you age");
}
var inputText = prompt("enter some text","Hello World");
switch(checkCharType(inputText)){
case "U":
document.write("First character was upper case");
break;
case "L":
document.write("First character was lower case");
break;
case "N":
document.write("First character was a number");
break;
default:
document.write("First character not character or character");
}
function checkCharType(charToCheck){
var returnValue = "O";
var charCodeValue = charToCheck.charCodeAt(0);
if(charCodeValue >= "A".charCodeAt(0) && charCodeValue <= "Z".charCodeAt(0)){
returnValue = "U";
}
if(charCodeValue >= "a".charCodeAt(0) && charCodeValue <= "z".charCodeAt(0)){
returnValue = "L";
}
if(charCodeValue >= "0".charCodeAt(0) && charCodeValue <= "9".charCodeAt(0)){
returnValue = "N";
}
return returnValue;
}
//var degCent;
//degCent = 5/9 * (degFahren - 32);
//alert(degCent+"\xB0 ");
//var greetingString ="Hello";
//var myName = prompt("Please enter your name","");
//document.write(greetingString + " " + myName + "<br>");
//concatString = greetingString + " " + myName ;
</script>
<p>Paragraph 3</p>
</body>
</html>