用jquery的css函数设置样式,例如下面例子中,点击按钮后p段落的字体颜色为红色
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html charset=utf-8" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p>用jquery的css函数设置样式,例如下面例子中,点击按钮后p段落的字体颜色为红色</p>
<button onclick="$('p').css('color','red')">点我试试</button>
</body>
</html>
下面的代码可以达到你想要的效果,jquery与js都有涉及:$().ready(function() {
var b, c, a = document.title
"undefined" != typeof document.hidden ? (b = "hidden", c = "visibilitychange") : "undefined" != typeof document.mozHidden ? (b = "mozHidden", c = "mozvisibilitychange") :"undefined" != typeof document.webkitHidden &&(b = "webkitHidden", c = "webkitvisibilitychange"), ("undefined" != typeof document.addEventListener || "undefined" != typeof document[b]) &&document.addEventListener(c, d, !1)
function d() {
document.title = document[b] ? "你想要的title。。" : a
}
})
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)