老师,属性选择器和表单属性选择器有什么区别吗
老师你好
这个视频中的代码:
var tr =document.getElementByTagName("tr");
这个tr是相当于数组吗?
function checkSex(){ var sex = document.getElementById("sex"); var span = document.getElementById("sex_span"); for(var i in sex){ if(sex[i].checked){ span.innerText = "性别选择成功"; span.style.color = "green"; return true; } } span.innerHTML = "请选择性别"; span.style.color = "red"; return false; } <tr> <td>性别:</td> <td> 男:<input type="radio" name="sex" id="" value="1" onclick="checkSex()"/> 女:<input type="radio" name="sex" id="" value="0" onclick="checkSex()"/> <span id="sex_span"></span> </td> </tr>
老师,为啥我return 了,这里选择了依然提示 请选择性别呢?
<body> <!--导航栏开始--> <div class="nav"> <div class="wrap"> <div class="logo"> <img src="jinli_images/logo.png" alt="无法加载"> </div> <div class="nav_right"> <div class="top"> <ul> <li><a href="#">amigo账号登陆</a><span> |</span></li> <li><a href="#">原账号登录</a><span> |</span></li> <li><a href="#">注册<span> |</span></a></li> <li><a href="#"><img src="jinli_images/shop.png" alt="无法加载" height="13" width="15">购物车(0)</a></li> </ul> </div> <div class="bottom"></div> </div> </div> </div> <!--导航栏结束--> </body>
.nav{ width: 100%; height: 105px; /*background-color: red;*/ border-bottom: 1px solid #d5d5d5; } .wrap{ width: 1190px; height: 104px; margin: 0 auto; padding-top: 20px; } .logo,.nav_right{ float:left; } .nav_right{ width:850px; height: 104px; } .top{ width:100%; height: 30px; line-height: 20px; padding-left: 90px; font-size: 13px; } .nav_right ul{ float: right; } .nav_right ul li{ float: left; margin: -5px 10px; } .nav_right ul li a{ color: #9f9f9f; } .top ul li:first-child a{ color:rgb(239,66,34); } .top ul li a:hover{ color:rgb(239,66,34); } .top ul li img:hover{ background-color: rgb(239,66,34); }
老师,我想问一下购物车旁边的那个小图标为什么不会跟着购物车一起出现同样的字体
<html> <head> <title>jQuery操作表格</title> <meta charset="UTF-8"/> <!--声明css代码域--> <style type="text/css"> tr{ height: 40px; } </style> <script type="text/javascript" charset="UTF-8" src="js/jquery-1.12.3.min.js"></script> <script type="text/javascript" charset="UTF-8" src="js/gwc.js"></script> </head> <body> <h3>jQuery操作表格</h3> <hr /> <input type="button" id="fx" value="反选" /> <input type="button" id="addRow" value="新增一行" /> <input type="button" id="delRow" value="删除行" /> <input type="button" id="copyRow" value="复制行" /> <table border="1px" cellpadding="10px" cellspacing="0" id="ta"> <tr> <td width="50px"><input type="checkbox" name="chks" id="chks" value="1" /></td> <td width="200px">书名</td> <td width="200px">作者</td> <td width="200px">数量</td> <td width="200px">操作</td> </tr> <tr id=""> <td><input type="checkbox" name="chk" id="" value="2"/></td> <td>《Java编程之道》</td> <td>wollo</td> <td>10</td> <td> <input type="button" name="aa" id="" value="修改数量" onclick="change(this)"/> <input type="button" name="" id="" value="删除" /> </td> </tr> <tr> <td><input type="checkbox" name="chk" id="" value="3" /></td> <td>《Python和我的故事》</td> <td>赵老师</td> <td>10</td> <td> <input type="button" name="" id="" value="修改数量" onclick="change(this)"/> <input type="button" name="" id="" value="删除" /> </td> </tr> <tr> <td><input type="checkbox" name="chk" id="" value="4" /></td> <td>《web开发详解》</td> <td>张老师</td> <td>30</td> <td> <input type="button" name="" id="" value="修改数量" onclick="change(this)"/> <input type="button" name="" id="" value="删除" /> </td> </tr> </table> </body> </html>
$(function(){ $("#chks").click(function(){ //确定全选和全不选的操作 var flag=$(this).prop("checked") $("input[name=chk]").prop("checked","flag"); /* if(flag){ $("input[name=chk]").prop("checked","true"); }else{ $("input[name=chk]").prop("checked","false"); } */ }) //判断是否全选 $("input[name=chk]").click(function(){ var flag=true; var chk=$("input[name=chk]") chk.each(function(){ if(!$(this).prop("checked")){ flag=false; return; } }) $("#chks").prop("checked",flag); }) //反选的操作 $("#fx").click(function (){ var chx=$("input[type=checkbox]"); chx.each(function(){ //获得多选框的初始的状态 var flag=$(this).prop("checked"); $(this).prop("checked",!flag); }) }) //新添加一行的操作 $("#addRow").click(function(){ //获得table对象 var tab=$("#ta"); tab.append('<tr id="">'+ '<td><input type="checkbox" name="chk" id="" value="2"/></td>'+ '<td>《Java编程之道》</td>'+ '<td>wollo</td>'+ '<td>10</td>'+ '<td>'+ '<input type="button" name="aa" id="" value="修改数量" /> '+ '<input type="button" name="" id="" value="删除" />'+ '</td>'+ '</tr>'); }) //删除的操作 $("#delRow").click(function(){ var del=$("input[name=chk]:checked"); if(del.length==0){ alert("至少选择一行"); }else{ //执行删除的操作 del.parent().parent().remove(); } }) //复制行 $("#copyRow").click(function(){ var copy=$("input[name=chk]:checked"); if(copy.length==0){ alert("至少选择一行"); }else{ //执行copy //复制 var tr=copy.parent().parent().clone(); //粘贴 $("#ta").append(tr); } }) //修改数量的操作 function change(th){ //tr节点 var par=$(th).parent().parent(); par.children().eq(3).html("<input type='text' size='3px'/>"); } })
老师我的jQuery引入正常,但是到修改数量就出现参数未定义,这个是哪里有问题
函数和方法不一样吗?
老师 我没理解 为什么 通过这种方式 会报错 不理解什么意思
老师上课这个例子 为什么下面那一层紫色(标准流)的跟小姐姐(float)不在同一层的会被顶下去 二者不是不在同一层吗
老师,请问为什么开发的时候不直接添加class属性,然后写css样式?这样不更简单吗?为什么要写css样式,再用jquery去操作?这样不是多了步骤?还是说这样去操作效率更高?
老师麻烦看一下我这个问题,为什么我加上这个方法,js文件夹就消失了呀?
老师,我这个换了别的表情图,可是显示不出来
下载的谷歌为什么打不开网页呢
老师为什么rowspan是将下面儿的行合并 而不是和上面儿的行合并啊
请问一下这个data() 报的错误是什么意思
老师 我想把可以跳动的心,变一个位子,为什么我 改这里 .cen{ width :200px height:200px } 心出现了扭曲呢?
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> body{ background-color: #ffa5a5; } .cen{ width: 200px; height: 200px; background-color: #d5093c; box-shadow: 0px 0px 70px #D5093C; /*执行动画的调用*/ animation: 1.5s aj infinite; } .lef{ /*倒圆角指令*/ border-radius: 100px; position: absolute; top: 200px; left: 262px; } .rig{ border-radius: 100px; position: absolute; top: 200px; left: 133px; } .e{ transform: rotate(45deg); position: absolute; top: 263px; left: 197px; } div:hover{ /*放大的倍数*/ transform: scale(1.3); } /*CS3 动画*/ @keyframes aj{ 0%{transform: scale(1) rotate(45deg);} 30%{transform: scale(1.1) rotate(45deg);} 60%{transform: scale(1.2) rotate(45deg);} 80%{transform: scale(1.1) rotate(45deg);} 100%{transform: scale(1) rotate(45deg);} } </style> </head> <body> <div class="cen lef"></div> <div class="cen e"></div> <div class="cen rig"></div> </body> </html>
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637