网页代码库


其它代码

网页中随时显示文本

看看效果 2008.10.14

xhtml部分

<p id="text">论语</p>

css部分

#text {
	border: 1px solid #FA9150;
	width: 300px;
	background: #FEF1E9;
	color: #000000;
	line-height: 50px;
	text-align: center;
	font-size: 14px;
	font-weight: bold;
}

JavaScript部分

function content() {
	var butong_net = new Array('有朋自远方来,不亦乐乎','己所不欲,勿施于人','四海之内皆兄弟也','学而不厌,诲人不倦','工欲善其事,必先利其器','人而无信,不知其可也','礼之用,和为贵'); 
	var butong_net2 = Math.floor(Math.random() * butong_net.length); 
	var text = document.getElementById("text");
	text.firstChild.nodeValue = butong_net[butong_net2];
}
window.onload = content;

关于我

站长:皮成,致力于web前端技术。

网站:收集以web前端技术实现的网页实例,探讨网页实例背后的web前端技术。

Email: Strict.dtd[at]Gmail.com QQ: 52541666