为了账号安全,请及时绑定邮箱和手机立即绑定
慕课网数字资源数据库体验端
JavaScript入门篇 _学习笔记_慕课网
为了账号安全,请及时绑定邮箱和手机立即绑定

JavaScript入门篇

慕课官方号 页面重构设计
难度入门
时长 1小时35分
  • <窗口对象>.close();
    查看全部
  • <title>函数调用</title> <script type="text/javascript"> function contxt() //定义函数,contxt()为名字 { alert("哈哈,调用函数了!"); } </script> </head> <body> <form> <input type="button" value="点击我" onclick="contxt()" />
    查看全部
  • 现在我要改变按钮的形状
    查看全部
  • document.getElementById("p1").style.color="blue"; 让p1变蓝
    查看全部
  • prompt,还是怎么打开新的网页
    查看全部
  • confirm,点击确定后怎么打开新的网页,
    查看全部
  • <script type="text/javascript"> function rec(){ var rep; rep = prompt("打开新窗口") if(rep == "") {window.open("http://www.imooc.com","_blank","width=400,height=500,top=100,left=0,toolbar=no,menubar=no");} else { window.open(rep,"_blank","width=400,height=500,top=100,left=0,toobar=no,menubar=no")} } </script>
    查看全部
    0 采集 收起 来源:编程练习

    2018-03-22

  • <!DOCTYPE html> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/> <title>练习总结</title> <script type="text/javascript"> function rec(){ var rep; rep = confirm("打开新窗口") if(rep == true) {window.open("http://www.imooc.com","_blank","width=400,height=500,top=100,left=0,toolbar=no,menubar=no");} else { document.write("还是算了吧")} } </script> </head> <body> <input type="button" name="rec" onClick="rec()" value="打开新窗口" /> </body> </html>
    查看全部
    0 采集 收起 来源:编程练习

    2018-03-22

  • <!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow() { var ifnew = confirm('是否打开新窗口?'); if(ifnew == true) { var weburl = prompt('请输入要打开的网址:'); if(weburl == '') weburl ='http://www.imooc.com/' window.open(weburl,'_blank', 'width=400,hegiht=500,toolbar=no,menubar=no'); } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>
    查看全部
    0 采集 收起 来源:编程练习

    2018-03-22

  • <!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow() { // 新窗口打开时弹出确认框,是否打开 var ifnew = confirm('是否打开新窗口?'); if(ifnew == true) { var weburl = prompt('请输入要打开的网址:'); if(weburl == '') weburl ='http://www.imooc.com/' window.open(weburl,'_blank', 'width=400,hegiht=500,toolbar=no,menubar=no'); } // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/ //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。 } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>
    查看全部
    0 采集 收起 来源:编程练习

    2018-03-22

  • (1) var obj = document.getElementById("txt"); obj.removeAttribute("style"); (2) var obj = document.getElementById("txt"); obj.style = null; (3)txt.style = "";
    查看全部
    0 采集 收起 来源:编程挑战

    2018-03-22

  • 左边例子输出为null,是因为代码是顺序执行的,先调用了JavaScript代码,但是这个时候还没有ID为“con”的元素,得到空
    查看全部
  • 样式:var mychar = document.getElementById("pcon"); mychar.style.color="red"; mychar.style.fontSize="20";
    查看全部
    0 采集 收起 来源:改变 HTML 样式

    2018-03-22

  • Object是获取的元素对象,如通过document.getElementById("id")获取的元素。
    查看全部
    0 采集 收起 来源:改变 HTML 样式

    2018-03-22

  • <!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow() { var open=confirm("是否打开链接窗口?"); if(open==true) { var openURL=prompt("你确定打开该网址吗?","http://www.imooc.com"); if(openURL!=null) { window.open(openURL,'_blank','meunbar=no,toolbar=no,scrollbar=yes,width=400,height=400'); } else { alert("你已取消打开该网址!"); } } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>
    查看全部
    1 采集 收起 来源:编程练习

    2018-03-22

举报

0/150
提交
取消
课程须知
该课程是针对新手的一个简单基础的课程,让您快速了解JS,通过一些简单的代码编写体会JS。如果您已经对JS有所了解,可以跳过本课程,学习JS进阶课程,进一步学习JS相应的基础知识。学习本课程,希望您至少具备HTML/CSS基础知识,认识常用的标签。
老师告诉你能学到什么?
1. 理解JavaScript基础语法; 2. 掌握常用语句的使用方法; 3. 学会如何获取DOM元素及进行简单操作。
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!