第一阶段JavaScript的学习总结

学习了
 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.οnlοad=initAll;//当页面装载完成时,就调用initAll函数;
function initAll(){
 document.getElementById("redirect").οnclick=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实例来熟悉了循环、函数的值传递、对象的探测、数组的处理。还学习了错误的处理。
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值