alert(没反应)!
来源:1-11 操作元素属性
Gudalow7
2020-10-27 21:44:56
# 具体遇到的问题
# 报错信息的截图
# 相关课程内容截图
# 尝试过的解决思路和结果
<!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;
}
/* 高亮css类 */
.highlight {
color: red;
font-size: 30px;
background: lightblue;
}
</style>
</head>
<body>
<div class="section">
<h2>jQuery选择器实验室</h2>
<input style="height: 24px" id="text" />
<button id="butselect" 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="https://www.pku.edu.cn/">北京大学</a>
</span>
</li>
</ul>
<span class="myclass">我是拥有myclass类的span标签</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" value="提交" /> <input type="reset" value="重置" />
</div>
</form>
</div>
</div>
<script type="text/javascript" src="jq/jquery-3.5.1.js"></script>
<script type="text/javascript">
var href = $('a[href*='163']').attr("href");
alert(href);
</script>
</body>
</html>
1回答
同学你好,如下位置处,引号使用错误,应更改为双引号而不是单引号

相似问题