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

JavaScript入门篇

难度入门
时长 1小时35分
学习人数
综合评分9.57
5509人评价 查看评价
9.8 内容实用
9.5 简洁易懂
9.4 逻辑清晰

已采纳回答 / 木子舟义
prompt("请输入网址:",  这个逗号写错了alert("再见"); 最后的分号写错了 alert("再见"); 分号写错了 onclick="openWindow()"  而不是ok = “openWindow()"<...code...>
//定义&quot;取消设置&quot;的函数
function restart(){
var res=document.getElementById(&quot;txt&quot;);
var rese=confirm(&quot;是否取消设置&quot;);
if(rese){
res.removeAttribute(&quot;style&quot;);
}
}
//定义&quot;隐藏内容&quot;的函数
function hideCOntext(){
var hid=document.getElementById(&quot;txt&quot;);
hid.style.display=&quot;none&quot;;}
//定义&quot;显示内容&quot;的函数
function display(){
var disp=document.getElementById(&quot;txt&quot;);
disp.style.display=&quot;block&quot;;}
//定义&quot;改变颜色&quot;的函数
function changeColor(){
var txColor=document.getElementById(&quot;txt&quot;);
txColor.style.color=&quot;green&quot;;
txColor.style.backgroundColor=&quot;pink&quot;;}
//定义&quot;改变宽高&quot;的函数
function changeWH(){
var cWH=document.getElementById(&quot;txt&quot;);
cWH.style.height=&quot;300px&quot;;
cWH.style.width=&quot;200px&quot;;}
&lt;script type=&quot;text/javascript&quot;&gt;
function rec(){
var mymessage=confirm(&quot;你是妹纸吗?&quot;) ;
if(mymessage==true)
{
document.write(&quot;你是女士!&quot;);
}
else
{
document.write(&quot;你是男士!&quot;);
}
}
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function rec(){
var mychar=&quot;I love JavaScript&quot;;
alert(mychar);
}
&lt;/script&gt;

最新回答 / 一毛钱
<...code...>好多错误,标注出来了,你对比看看

已采纳回答 / Q南极熊Q
先把原来的设置保存到变量里,恢复的时候把变量赋值就行了
function openWindow(){
var open=confirm(&quot;确定打开新窗口?&quot;);
if(open==true){var openConfirm=prompt(&quot;确定打开以下网址?&quot;,&quot;http://www.imooc.com/&quot;);
if(openConfirm !=null){window.open(&#039;http://www.imooc.com/&#039;,&#039;_blank&#039;,&#039;width=400px,height=500px,menubar=no,toolbar=no&#039;)}else{}} else{}}
课程十分的好
function openWindow(){
var open=confirm(&quot;打开新窗口&quot;);
if(open==true)
{
window.open(&#039;http://www.imooc.com/&#039;,&#039;_blank&#039;,&#039;width=400px,height=500px,menubar=no,toolbar=no&#039;)
}
else{

}
}
function openWindow(){
var aa= confirm(&quot;确定打开新窗口吗&quot;);
if(aa=true){
var bb=prompt(&quot;打开下面网址&quot;,&quot;http://www.imooc.com/&quot;);
if(bb!=null){
window.open(bb,&#039;_blank&#039;,&#039;toolbar=no,menubar=no&#039;,&#039;width=400px,height=500px&#039;);

}
}
}

已采纳回答 / Caballarii
300px没加引号,导致所有js都没执行
&lt;script type=&quot;text/javascript&quot;&gt;
var score =80; //score变量存储成绩,初值为80
if(score&gt;=60); //score&gt;=60是判断条件
{
document.write(&quot;很棒,成绩及格了。&quot;);
}
else //否则不及格
{
document.write(&quot;加油,成绩不及格。&quot;);
}
&lt;/script&gt;
感觉JS好难
课程须知
该课程是针对新手的一个简单基础的课程,让您快速了解JS,通过一些简单的代码编写体会JS。如果您已经对JS有所了解,可以跳过本课程,学习JS进阶课程,进一步学习JS相应的基础知识。学习本课程,希望您至少具备HTML/CSS基础知识,认识常用的标签。
老师告诉你能学到什么?
1. 理解JavaScript基础语法; 2. 掌握常用语句的使用方法; 3. 学会如何获取DOM元素及进行简单操作。

微信扫码,参与3人拼团

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

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消