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

JavaScript入门篇

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

最新回答 / 慕圣514155
一、改为onclick="init()",onclick="init1()",onclick="init2()",onclick="init3()",onclick="init4()"二、函数init3()(显示内容的方法),你针对id=four的p标签进行操作,但是它本来就是显示的,你可以改为                    var four1 = document.getElementById("three");        在对id为three的p标签进行隐藏后在使用这个按钮就可以显示内容了...
//定义"取消设置"的函数
function qx() {
var message = confirm("是否取消设置");
if(message == true) {
obj.removeAttribute('style');
}else{
alert("点击了取消设置");
}
}
//定义"显示内容"的函数
function xs() {
obj.style.display = "block";
}
//定义"隐藏内容"的函数
function yc() {
obj.style.display = "none";
}
//定义"改变宽高"的函数
function wh() {
obj.style.width = "300px";
obj.style.height = "200px";
}
var obj = document.getElementById("txt");
//定义"改变颜色"的函数
function colors() {
obj.style.color = "red";
obj.style.backgroundColor = "#ccc";
}
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className = "two";
}
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display = "none";
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display = "block";
}

最新回答 / 木子955
<script>var answer  = confirm("是否要打开新窗口?");var newHeight = window.screen.height/2;var newWidth = window.scree.width/2;if(answer){ window.open("http://www.imooc.com","_blank","width=newWidth,height=newHeight");}</script>
var mychar= document.getElementById(&quot;con&quot;) ;
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标签内容
var mychar= document.getElementById(&quot;con&quot;).innerHTML ;
function openWindow() {
var myClick = confirm(&quot;点击了按钮&quot;);
if(myClick==true) {
var url = prompt(&quot;确定打开网址&quot;,&#039;http://www.imooc.com/&#039;)
if(url!=null) {
window.open(url,&#039;_blank&#039;,&#039;width=400,height=0,menubar=no,toolbar=no&#039;);
}

}else {
alert(&quot;取消点击&quot;);
}

}

最新回答 / showmylifeqwe11
<!DOCTYPE html><html> <head>  <title> new document </title>    <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>     <script type="text/javascript">      function openWindow(){        // 新窗口打开时弹出确...

最新回答 / qq_慕田峪639222
你可以把代码复制到自己的工具上查看
function openWindow(){
var newWindow = confirm(&quot;是否打开新窗口?&quot;);
if(newWindow==true){
var uno = window.open(&#039;http://www.imooc.com/&#039;,&#039;_blank&#039;,&#039;width=400,height=500,menubar=no,toolbar=no&#039;);
}else{}
};

已采纳回答 / 慕虎8548524
CSS样式是静态的,而JS可以交互更改样式。不仅可以调用样式且维护省事修改简洁
课程须知
该课程是针对新手的一个简单基础的课程,让您快速了解JS,通过一些简单的代码编写体会JS。如果您已经对JS有所了解,可以跳过本课程,学习JS进阶课程,进一步学习JS相应的基础知识。学习本课程,希望您至少具备HTML/CSS基础知识,认识常用的标签。
老师告诉你能学到什么?
1. 理解JavaScript基础语法; 2. 掌握常用语句的使用方法; 3. 学会如何获取DOM元素及进行简单操作。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消