为了账号安全,请及时绑定邮箱和手机立即绑定

JavaScript入门篇

难度入门
时长 1小时35分
学习人数
综合评分9.57
5509人评价 查看评价
9.8 内容实用
9.5 简洁易懂
9.4 逻辑清晰
removeAttribute("style")真好用!
<!DOCTYPE HTML>
<html>
<head>
<title>js</title>
</head>
<body>
<script type="text/javascript">
document.write("helo");
document.getElementById("p1").style.color="blue";
</script>
</body>
</html>
function openWindow(){
if(confirm("是否打开新窗口?")){
var url=prompt("要打开的网站:");
console.log(url);
if(url!=null){
window.open(url,'width=400','height=500',"_blank","menubar=no","toolbar=no");
}else{
window.open('http://www.qq.com',"_blank","menubar=no","toolbar=no");
}
}
}

已采纳回答 / 慕圣2639889
<!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 queren=confir...

已采纳回答 / 巴黎地铁
这只是举个例子,证明JS可以控制页面中的元素。
&lt;h2 id=&quot;con&quot;&gt;javascript课程&lt;/h2&gt;
&lt;input type=&quot;button&quot; value=&quot;改变宽高&quot; onClick=&quot;cwh()&quot; /&gt;
&lt;script&gt;
var con=document.getElementById(&quot;con&quot;);
//定义“改变宽高”的函数
function cwh() {
con.style.width=&quot;200&quot;;
con.style.height=&quot;300&quot;;
}
&lt;/script&gt;
改变宽高的那个,看不出效果呀,是我写错了吗?

最新回答 / 丶大和小
function chongzhi(){    var chongzhi=confirm("是否重置");    if(chongzhi==true){    obj.style.height="400px";    obj.style.width="600px";    obj.style.border="#333 solid 1px";    obj.style.padding="5px";    obj.style.background="white";    obj.style.color="bl...

已采纳回答 / weibo_玥玥说她不叫玥玥_0
var url = prompt("通过对话框,确认打开的网址","http://www.imooc.com");这句中的逗号你用了中文格式,改成英文的就可以了

最新回答 / Sunny_刘俊池
你仔细检查一下你的代码是否有错误!只要是对的应该不会出错
score =prompt(&quot;请输入你的成绩:&quot;,&quot;80&quot;);

最新回答 / 我乐意
  function cancel(){      var mychar=document.getElementById("txt");      var message=confirm("确定取消所有设置?");      if(message==true){          mychar.removeAttribute("style");      }      else{          alert("保留设置");      }  }
function hidetext()
{
var mychar = document.getElementById(&quot;con&quot;);
document.getElementById(&quot;con&quot;).style.display = &quot;none&quot;;
}
function showtext()
{
var mychar = document.getElementById(&quot;con&quot;);
document.getElementById(&quot;con&quot;).style.display = &quot;block&quot;;
}
课程须知
该课程是针对新手的一个简单基础的课程,让您快速了解JS,通过一些简单的代码编写体会JS。如果您已经对JS有所了解,可以跳过本课程,学习JS进阶课程,进一步学习JS相应的基础知识。学习本课程,希望您至少具备HTML/CSS基础知识,认识常用的标签。
老师告诉你能学到什么?
1. 理解JavaScript基础语法; 2. 掌握常用语句的使用方法; 3. 学会如何获取DOM元素及进行简单操作。

微信扫码,参与3人拼团

意见反馈 帮助中心 APP下载
官方微信
友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消