2;询问框prompt();确认框confirm("");提示框 alert(“”);
3;document.getElementById(“”)可以修改任意一个标签的任意属性值;
4: alert( isNaN("2")); 输出结果:false
alert(isNaN(2)); 输出结果: false
alert(isNaN(3.2)); 输出结果: false
var a=0;
alert(a=2); 输出结果: 2
alert(isNaN(2=="2")); 输出结果: false
alert(isNaN(2==="2")); 输出结果:false
所有的数据类型都可以是var 型的,isNaN是判断是否为字符串型的,当是的时候返回的是tuer 否则为flise,
一个等号表示数据类型相等,两个等号表示值值相等,三个等号表示值和对象都相等的时候。
字符串(String)、数字(Number)、布尔(Boolean)、数组(Array)、对象(Object)、空(Null)、未定义(Undefined)。
字符串可以是引号中的任意文本。您可以使用单引号或双引号:
获取时间函数Date()。
getFullYear()
使用 getFullYear() 获取年份。
getTime()
getTime() 返回从 1970 年 1 月 1 日至今的毫秒数。
setFullYear()
如何使用 setFullYear() 设置具体的日期。
toUTCString()
如何使用 toUTCString() 将当日的日期(根据 UTC)转换为字符串。
getDay()
如何使用 getDay() 和数组来显示星期,而不仅仅是数字。
Display a clock
如何在网页上显示一个钟表。
有四种方式初始化日期:
new Date(milliseconds) //返回从 1970 年 1 月 1 日至今的毫秒数
new Date(dateString)
new Date(year, month, day, hours, minutes, seconds, milliseconds)
点击2次点击事件
<script>
function changeImage()
{
element=document.getElementById('myimage')
if (element.src.match("bulbon"))
{
element.src="/statics/images/course/pic_bulboff.gif";
}
else
{
element.src="/statics/images/course/pic_bulbon.gif";
}
}
</script>
<img id="myimage" οnclick="changeImage()"
src="/statics/images/course/pic_bulboff.gif" width="100" height="180">
<p>点击灯泡就可以打开或关闭这盏灯</p>