<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title>myTest</title>
<script src="../js/jquery-1.3.2.min.js"></script>
<script>
$( function() { $("p").attr("align",function(){return this.style});
}); });
</script>
</head>
<body>
<p style="center">nihao!</p>
</body>
</html>为什么运行完后 段落没有居中呢?
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title>myTest</title>
<script src="../js/jquery-1.3.2.min.js"></script>
<script>
$( function() { $("p").attr("align",function(){return this.style});
}); });
</script>
</head>
<body>
<p style="center">nihao!</p>
</body>
</html>为什么运行完后 段落没有居中呢?
$("p").css("text-align", "center");
});
$("p").attr("align",function(){
return this.id;
})})
<p id="center">testtesttesttesttesttest</p>
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
.img_bor
{
border: solid 5px red;
}
</style>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title>myTest </title>
<script type="text/javascript" language="javascript" src="http://static.cy-inc.com.cn/resources/js/jquery/jquery.20090603.js"></script><script>
$(function() {
$("p").attr("style","text-align: center");
});
</script>
</head>
<body>
<img src="http://img0.cy-inc.com.cn/images/club2/club_gift_get.gif" title="http://img0.cy-inc.com.cn/images/club2/club_gift_get.gif"/>
<p>ggggggggggggggggggggggggggg</p>
</body>
</html>
-----------这样写是楼主想要的吗?
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
.img_bor
{
border: solid 5px red;
}
.txtalign
{
color: green;
}
</style>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title>myTest </title>
<script type="text/javascript" language="javascript" src="http://static.cy-inc.com.cn/resources/js/jquery/jquery.20090603.js"></script><script>
$(function() {
$("p").attr("class","txtalign");
});
</script>
</head>
<body>
<p>ggggggggggggggggggggggggggg</p>
</body>
</html>