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

JavaScript入门篇

难度入门
时长 1小时35分
学习人数
综合评分9.57
5509人评价 查看评价
9.8 内容实用
9.5 简洁易懂
9.4 逻辑清晰
作为一个新手,我郑重的告诫学到这会儿的,都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评论!!!!!!!!!!!!!!!!!!!都不要看评

最新回答 / 嚯霍嚯
document.getElementsByTagName("div")[0].removeAttribute("style");//定义"取消设置"的函数
function changeCf(){
if(confirm("是否取消设置回复默认?")){
text=document.getElementById("txt");
text.setAttribute('style','');
}
else{
return false;//定义"取消设置"的函数
}
var text=document.getElementById("txt");//定义"隐藏内容"的函数
function changeDn(){
text.style.display="none";
}
var text=document.getElementById("txt");//定义"显示内容"的函数
function changeDb(){
text.style.display="block";
}
var text=document.getElementById("txt");//定义"改变宽高"的函数
function changeWh(){
text.style.width="300px";
text.style.height="500px";
}
<script type="text/javascript">
var text=document.getElementById("txt");//定义"改变颜色"的函数
function changeColor(){
text.style.color="red";
text.style.backgroundColor="blue";
}

已采纳回答 / weibo_好好死一回_0
<...code...>不知道你的具体问题何在,以上是我编写的代码,能出效果。p1.className="one";这一句就是给id="p1"的元素添加"类名为one"的样式。如有疑问,欢迎追问

已采纳回答 / 慕粉3585893
因为document.getElementById("con");此时它只是获得了id为con的对象,并不是它的内容。所以输出结果是那样的,意思是这是一个段落对象。
con.style.cssText=&#039;color:red;background:#ccc;width:300px&#039;;
function rec(){
var score;
score = prompt(&quot;考多少分?&quot;);
if(score&gt;=90)
{
document.write(&quot;上来就是一个么么哒!&quot;);
}
else if(score&gt;=75)
{
document.write(&quot;这个月加下月0花钱&quot;);
}
else if(score&gt;=60)
{
document.write(&quot;还知道回家?!&quot;);
}
else
{
document.write(&quot;爸妈把藏多年秘密和你说,你是捡来的!&quot;);
}
}
是初学者就来吧
function rec(){
var mymessage= confirm(&quot;是女士吗?&quot;) ;
if(mymessage==true)
{
document.write(&quot;来这里学习的都是女神!&quot;);
}
else
{
document.write(&quot;男屌丝来这里学习有前途!&quot;);
}
}
&lt;/script&gt;
var mychay=&quot;在座的各位&quot;
var mystr = &quot;都是&quot;;

var mychar = &quot;大神!&quot;;

document.write(mystr+mychar+chay);
&lt;script type=&quot;text/javascript&quot;;
function hidetext(){
var mychar=document.getElementById(&quot;con&quot;);
mychar.style.display=&quot;none&quot;;
}
function showttext(){
var mychar=document.getElementById(&quot;con&quot;);
mychar.style.display=&quot;block&quot;;
}
&lt;/script&gt;
function c(){
var nji=document.getElementById(&quot;txt&quot;)
txt.style.display=&quot;none&quot;;
}
//定义&quot;显示内容&quot;的函数
function d(){
var kok=document.getElementById(&quot;txt&quot;)
txt.style.display=&quot;block&quot;;
}
//定义&quot;取消设置&quot;的函数
function e(){
var bbh=confirm()
if(bbh=&quot;true&quot;)
txt.removeAttribute(&quot;style&quot;);}
&lt;script type=&quot;text/javascript&quot;&gt;
var mychar=document.getElementById(&#039;con&#039;);
document.write(&quot;原标题:&quot;+mychar.innerHTML+&quot;&lt;br&gt;&quot;); //输出原h2标签内容
mychar.innerHTML = &quot;Hello world!&quot;;
document.write(&quot;修改后的标题:&quot;+mychar.innerHTML); //输出修改后h2标签内容
&lt;/script&gt;
课程须知
该课程是针对新手的一个简单基础的课程,让您快速了解JS,通过一些简单的代码编写体会JS。如果您已经对JS有所了解,可以跳过本课程,学习JS进阶课程,进一步学习JS相应的基础知识。学习本课程,希望您至少具备HTML/CSS基础知识,认识常用的标签。
老师告诉你能学到什么?
1. 理解JavaScript基础语法; 2. 掌握常用语句的使用方法; 3. 学会如何获取DOM元素及进行简单操作。

微信扫码,参与3人拼团

微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消