* {
padding: 0;
margin: 0;
}
body {
background-color: gray;
.container {
width: 300px;
height: 200px;
background-color: white;
margin: 100px auto;
.container.up {
height: 50px;
width: 100%;
.container .up ul {
list-style: none;
text-align: center;
.container .up ul li {
float: left;
line-height: 50px;
width: 60px;
.container .up ul li a {
text-decoration: none;
font-size: 20px;
.select {
border-bottom: 2px solid orange;
.container .down {
height: 100px;
position: relative;
.container .down div {
position: absolute;
line-height: 100px;
height: 100%;
display: none;
.container .down div .div-select {
display: block;
为啥我这个 div-select 中 displayblock 优先级还是不够 我加了!import 那个百度内容才显示出来
此时打印的位置在删除代码的前面,为什么打印结果已经是删除了的
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> li:hover{background-color: orange} li{background-color: skyblue} </style> </head> <body> <script> var arr=["首页","军事","娱乐","历史","政治"]; var ul=document.createElement('ul'); var ul_style=document.createAttribute("style"); ul_style.value="list-style:none; padding:0; margin:0"; ul.setAttributeNode(ul_style); for(var i=0;i<arr.length;i++){ var li=document.createElement('li'); var li_style=document.createAttribute("style"); li_style.value="display:inline-block;width:100px;height:30px;line-height:30px;text-align:center;margin-left:5px"; li.setAttributeNode(li_style); var a=document.createElement("a"); var a_style=document.createAttribute("style"); a.setAttributeNode(a_style); a.innerHTML=arr[i]; li.appendChild(a); ul.appendChild(li); } document.body.appendChild(ul); </script> </body> </html>
leftBtn.onclick = function () {
idx--
console.log(idx);
changePic();
rightBtn.onclick = function () {
idx++
感觉左右切换图片显示的按键,左侧idx--右侧idx++比较好,与下方的指示器能对上
为什么获取元素对象只能用getElementById啊,用别的获取就会报错
/\bhello/.test("hi,hello"); // true /\bhello/.test("helloworld"); // false /\Bhello/.test("hi,hello"); // false /\Bhello/.test("helloworld"); // true
文档里的好像错了
老师,我的输出那个三角形,用alert(“”)和console(“”);输出都可以换行,为什么用document.write(“”);输出就不能换行?
老师,这个怎么计算,控制台显示138,我算的136
问题:下面这个打印出来的类型是布尔类型吗?我目前的认可是未定义类型,但是打印出来时是布尔类型?
麻烦老师解释一下!
var age; console.log(typeof age)
代码:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <script> var age = "123" console.log(typeof age) //字符串类型 var age = 123; console.log(typeof age) //数字类型 var age = true; console.log(typeof age) //布尔类型 var age; console.log(typeof age) //未定义? </script> </body> </html>
打印的效果图:
老师 这地方取出具体的值不能直接写
pivot=arr[pivotIndex];
吗
对象本身方法是不是不常用?
/t?est/.test("tttest")为什么能通过,到底是怎么读取的,视频没说清楚
alert('hello world');
1练习中问题一
老师金字塔是怎么做出的呢,我的代码是在哪一处有了问题的呢
代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>for循环联系打印</title> </head> <body> <script> /* /!*打印5行5列的矩形 * * * * * * * * * * * * * * * * * * * * * * * * * *!/ for (var j=1;j<5;j++){ //外层循环控制行 for (var i=1;i<5;i++){ //内层循环控制列 document.write("*") } document.write("<br/>"); }*/ /*打印5行5列的矩形 * * * * * * * * * * * * * * * for (var j=1;j<5;j++){ //外层循环控制行 for (var i=1;i<=j;i++){ //内层循环控制列 document.write("*") } document.write("<br/>"); }*/ /*打印5行5列的矩形 * * * * * * * * * * * * * * * */ var alt=""; for (var i=1;i<=5;i++){ //控制行 var blank="" for (var j=1;j<=5-i;j++){ //空白三角形 blank+="" } var stars=""; for (var m=1;m<=2*i-1;m++){ stars+="*"; } alt+=blank+stars+"\n"; } console.log(alt); </script> </body> </html>
运行图.
作业图
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <!-- * *** ***** ******* ********* --> <script> var alt=''; for(var i=1;i<=5;i++){ var blank=""; var start=""; for(var j=1;j<=5-i;j++){ blank+=""; } for(var m=1;m<=2*i-1;m++){ start+='*'; } alt=blank+start+'\n' } console.log(alt); </script> </body> </html>
老师为啥我变量alt只打印了最后一次
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637