论坛首页 入门技术论坛

【原创】百度知道等级形象!

浏览 1785 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-02-25  

常用百度知道,写了个js,代码如下:

<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=GBK">
		<title>百度知道等级图标</title>
	</head>
	<script type="text/javascript">
		var zhidaoClass =new Array ("公司白领","魔法师","科举夺魁","武将","江湖奇侠");
		function showImgByClass(){
			var content = "";
			content += "<table>";
			// 形象类别
			for(var r=0;r<5;r++){
				content += "<td>"+zhidaoClass[r]+"</td>";
				// 性别
				for(var s=1;s<3;s++){
					content += "<tr>";
					// 角色等级
					for(var g=1;g<19;g++){
						content += "<td>";
						content += "<img src='http://img.baidu.com/img/iknow/images/r"+r+"s"+s+"g"+g+".gif' />";
						content += "</td>";
					}
					content += "</tr>";
				}				
			}
			content += "</table>";
			document.getElementById("imgContent").innerHTML=content;
		}
		function showImgByGrade(){
			var content = "";
			content += "<table>";
			content += "<tr><th></th>";
			for(var h=0;h<5;h++){
				content += "<th>"+zhidaoClass[h]+"</th>";
			}
			content += "</tr>";
			// 角色等级
			for(var g=1;g<19;g++){				
				// 性别
				for(var s=1;s<3;s++){
					content += "<tr>";
					content += "<td>"+(s==1?"男":"女")+"</td>";
					// 形象类别
					for(var r=0;r<5;r++){
						content += "<td>";
						content += "<img src='http://img.baidu.com/img/iknow/images/r"+r+"s"+s+"g"+g+".gif' />";
						content += "</td>";
					}
					content += "</tr>";
				}				
			}
			content += "</table>";
			document.getElementById("imgContent").innerHTML=content;
		}
	</script>
	<body>
		<h1>百度知道各阶段形象表</h1>
		<button onclick="showImgByGrade();">按等级排列</button>
		<button onclick="showImgByClass();">按形象排列</button>
		<hr/>
		<div id="imgContent"></div>
	</body>
</html>

 

论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics