第一阶段JavaScript的学习总结
2009-08-02 10:32
489 查看
学习了
1.通过document.getElementById("helloMessage").innerHTML="hello,world!";<h1 id="helloMessage"></h1>来把输出内嵌到<h1>标签里面。
2.alert()函数对用户的警告。
3.通过prompt("are you sure you want to do that:","default");函数来对用户进行提示具体:
var ans=prompt("are you sure you want to do that:","default"); ans既是一个Boolean值也是一个被赋值的变量。"default"为默认回复
if(ans){
alert("you said "+ans);
}
else{
alert("you refused to answer");
}
4.通过confirm(" ");来确认用户的选择。返回一个Boolean值。
5.用链接对用户进行重定向。具体看实例:
window.onload=initAll;//当页面装载完成时,就调用initAll函数;
function initAll(){
document.getElementById("redirect").onclick=initRedirect;
}
function initRedirect(){
alert("we are not responsible for the content of pages outside our site");
window.location="jswelcome.html";
return false;//表示停止对用户点击的处理,这样就不会装载href指向的页面;反之则又转到href指向的页面。
//window.location=this;也可以转到href指向的页面,直接return true也可以。
}
对应的HTML端<a href="j_3.html" id="redirect">click here to the other page</a>
6.通过一个bingo实例来熟悉了循环、函数的值传递、对象的探测、数组的处理。还学习了错误的处理。
1.通过document.getElementById("helloMessage").innerHTML="hello,world!";<h1 id="helloMessage"></h1>来把输出内嵌到<h1>标签里面。
2.alert()函数对用户的警告。
3.通过prompt("are you sure you want to do that:","default");函数来对用户进行提示具体:
var ans=prompt("are you sure you want to do that:","default"); ans既是一个Boolean值也是一个被赋值的变量。"default"为默认回复
if(ans){
alert("you said "+ans);
}
else{
alert("you refused to answer");
}
4.通过confirm(" ");来确认用户的选择。返回一个Boolean值。
5.用链接对用户进行重定向。具体看实例:
window.onload=initAll;//当页面装载完成时,就调用initAll函数;
function initAll(){
document.getElementById("redirect").onclick=initRedirect;
}
function initRedirect(){
alert("we are not responsible for the content of pages outside our site");
window.location="jswelcome.html";
return false;//表示停止对用户点击的处理,这样就不会装载href指向的页面;反之则又转到href指向的页面。
//window.location=this;也可以转到href指向的页面,直接return true也可以。
}
对应的HTML端<a href="j_3.html" id="redirect">click here to the other page</a>
6.通过一个bingo实例来熟悉了循环、函数的值传递、对象的探测、数组的处理。还学习了错误的处理。
相关文章推荐
- linux第一阶段学习总结
- 第一阶段总结:学习与改变
- 惠普实训第一阶段学习总结
- 学习J2ME第一阶段总结:helloworld
- JavaScript学习阶段 - 简要版总结(2016.06)
- 学习CCNA的第一阶段总结
- Spring入门学习——第一阶段学习总结图
- 自我总结(六)---(学习j2ee+j2ee第一阶段项目)
- 【自考】第一阶段学习总结
- 第一阶段学习总结.章一至章六
- 嵌入式linux学习计划第一阶段总结
- 个人学习第一阶段——关于html和css的技巧及问题总结(一)
- C++之第一阶段学习总结
- ios FFmpeg第一阶段学习总结
- java基础第一阶段的学习总结。
- 自考第一阶段学习总结
- 惠普第一阶段学习总结
- ORACLE的学习笔记第一阶段总结
- 我的js学习笔记之第一阶段总结即小作业贪吃蛇V0.1
- 百度前端技术学院第一学习阶段总结