<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>设置元素的属性(二)</title>
<script src="jquery-1.8.0.js"></script>
</head>
<style type="text/css">
body{
font-size:12px;
}
.clsSpn{
float:left;
padding-top:10px;
padding-left:10px;
}
.clasImg{
border:solid 1px #ccc;
padding:3px;
float:left;
}
</style>
<script type="text/javascript">
$(function(){
$("img").attr("src",function(){
return "Images/"+
Math.floor(Math.random()*2+1)+".jpg"
});
$("img").attr("title","这是一幅风景画");
$("img").addClass("clsImg");
});
</script>
<body>
<img src="Images/2.jpg" alt="" style="float:left" />
</body>
</html>
设置元素的属性(二)
最新推荐文章于 2022-12-12 11:37:34 发布