<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>带有提示文字的滚动条</title> <style> div{ width: 25px; height: 25px; border: 1px solid black; line-height: 25px; text-align: center; position: absolute; display: none; } </style> </head> <body> <input type="range" min="0" max="100" value="5"> <div></div> <script> var input=document.querySelector('input'); var div=document.querySelector('div'); var flag=false; input.onmousemove=function () { if (flag==true){ var left=event.clientX; if (left>135){left=135;} if (left<14){left=14;} div.style.left=left+'px'; div.innerHTML=input.value; div.style.display='black'; } }; input.onmousedown=function () { flag=true; div.style.display='none' }; input.onmouseup=function () { flag=false; div.style.display='none' } </script> </body> </html>
老师,怎么拖动的时候下面怎么不出数字?我也赋值了。谢谢老师
这个 html文件,js文件,css文件的注释快捷键分别是什么
老师,我下载的
Doc1.docx
插件没有用是怎么回事啊
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>横向布局的导航栏</title> </head> <!--<style> ul{list-style: none;padding: 0;margin: 0;} ul li{display:inline-block; width:100px; height:100px;line-height:30px;text-align:center; background-color:skyblue;} li a{text-decoration: none;color: white;} li:hover{background-color: red;} li:hover a{color: greenyellow;} </style>--> <style> li:hover{background-color: red} li:hover a{color: greenyellow} </style> <body> <!-- <ul> <li><a href="#">首页</a></li> <li><a href="#">军事</a></li> <li><a href="#">新闻</a></li> <li><a href="#">娱乐</a></li> </ul>--> <script> var arr=['首页','军事','娱乐','新闻',]; //创建ul标签 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); //创建li标签 for(var i=0;i<4;i++){ var li=document.createElement('li'); var li_style=document.createAttribute('style'); li_style.value='display:inline-block; width:100px; height:100px;line-height:30px;text-align:center;/ background-color:skyblue;'; li.setAttributeNode(li_style); ul.appendChild(li); //创建a标签 var a=document.createElement('a'); var a_style=document.createAttribute('style'); a_style.value='text-decoration: none;color: white;'; a.setAttributeNode(a_style); li.appendChild(a); a.innerHTML=arr[i]; } document.body.appendChild(ul); </script> </body> </html> 哪里的问题,我的不显示出来
// 2.将⼀段字符串变成驼峰命名法 var str = "hello-world"; var arr=str.split("-"); var result=""; for(i=0;i<arr.length;i++){ var word=arr[i]; result+=word.charAt(0).toUpperCase()+word.substr(1); } console.log(result);
就是这个代码中,charAt()和toUpperCase()不是字符串的方法嘛,为什么word这个数组可以用呀
var arr1 = [1,2,3]; var arr2 =arr1; var arr3 = arr1; arr1=[1,2,3,4] console.log(arr1); console.log(arr2); console.log(arr3); var arr1 = [1,2,3]; var arr2 =arr1; var arr3 = arr1; arr1.pop(); console.log(arr1); console.log(arr2); console.log(arr3);
数组地址传递,为什么arr2输出还是[1,2,3]呢?
第二种可以,第一种为什么不可以呢?
var arr = [1,1,3,2,4,5,6,6,1,6];
var array = [];
for(var i = 0;i<arr.length;i++){
if(array.___(arr[i]) === -1){
array.___(arr[i])
}
console.log(array);
老师,他这个是怎么实现去除不相邻的元素的
for(var i = 1; i<=9; i++) {
console.log("i=" +i);
for(var j=1; j<=9; j++) {
console.log("j="+j);
这里为什么不用给add 和muit传参数
解决了,老师 有个单词拼写错了,谢谢.......................................................
为什么外层的for每次只打印一次而里面的for每次都打印了9次呀
套的有点蒙,有点没搞懂原理
老师做的笔记中说var可以声明全局变量(图1),但ppt中显示var声明的变量称为全局变量(图2),这怎么理解
为什么最后一个子标签不是文本,</script>和</body>之间不是有空格吗
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <div class="div1">div1 <div id="div2">div2</div> </div> <span>这是span标签</span> <script> var div1=document.querySelector('.div1'); var div2=document.querySelector('#div2'); var span=document.querySelector('span'); /* 1.textContent 描述:返回当前节点和它的所有后代节点的文本内容。 var result=document.getElementById('divA').textContent// This is some text console.log(result); 2.nodeValue 描述:nodeValue属性一般只用于Text节点 console.log(span.firstChild.nodeValue); span.firstChild.nodeValue='新的span值'; 3.childNodes属性 描述:childNodes属性返回一个节点集合(NodeList),节点集合中包括当前节点的所有子节点 例子: var childList=div1.childNodes; console.log(childList); console.log(childList.length); console.log(childList instanceof Array); console.log(childList[1]); 4.firstChild/ lastChild 描述:返回第一个\最后一个子节点,如果不存在返回null console.log(div1.firstChild); console.log(div1.lastChild); */ console.log(document.body.firstChild); console.log(document.body.lastChild); </script> </body> </html>
在第一种方法中,array和arr[i]有什么关系?为什么打印array是arry[i]的结果呢?没搞懂这个过程
没搞懂Object本身和实例的概念
感觉好抽象
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637