老师帮我看下哪里错了,没有实现效果
来源:1-11 操作元素属性
qq_慕设计1529493
2019-07-04 17:09:58
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>操作元素属性</title>
<style>
.myclass{
font-style:italic;
color: darkblue;
}
.highlight{
color: red;
font-size: 30px;
background: lightblue;
}
</style>
</head>
<body>
<div class="section">
<h2>jQuery选择器实验室</h2>
<input style="height: 30px" id="txtSelector" />
<button id="btnSelect" style="height: 30px">选择</button>
<hr />
<div>
<p id="welcome">欢迎来到选择器实验室</p>
<ul>
<li>搜索引擎:<a href="http://www.baidu.com">百度</a><span><a style="color: darkgreen" href="http://www.so.com">360</a></span>
</li>
<li>电子邮箱:<a href="http://mail.163.com">网易邮箱</a><span><a style="color: darkgreen" href="http://mail.qq.com">qq邮箱</a></span>
</li>
<li>中国名校:<a href="http://www.tsinghua.edu.cn">清华大学</a><span><a style="color: darkgreen" href="http://www.pku.edu.cn">北京大学</a></span>
</li>
</ul>
<span class="myclass">我是拥有myclass类的spam标签</span>
<p class="myclass">我是拥有myclass类的p标签</p>
<form id="info" action="#" method="get">
<div>
用户名:<input type="text" name="uname" value="admin" />密码:<input type="password" name="upsd" value="123456"/>
</div>
<div>
婚姻情况:<select id="marital_status">
<option value="1">未婚</option>
<option value="2">已婚</option>
<option value="3">离异</option>
<option value="4">丧偶</option>
</select>
</div>
<div class="left clear-left">
<input type="submit" name="" value="提交"/><input type="reset" name="" value="重置">
</div>
</form>
</div>
</div>
<script type="text/javascript" src="js/jquery-3.4.1.js"></script>
<script type="text/javascript">
var href_attr = ${"a[href*='163']"}.attr("href");//一个参数为获取属性
alert(href_attr);
${"a[href*='163']"}.attr("href" , "http://www.163.com");//两个参数为设置属性
</script>
</body>
</html>
1回答
同学你好!同学这里不小心写成 {} 了,应该是()呢
如果我的回答解决了你的疑惑,请采纳,祝学习愉快~
相似问题
回答 2
回答 2