今天弄知识百科竞赛所做的小网页,里面有个坑,很大很大的坑,就是一个<img src>必须要有</img>不然有些内容就会被吞掉
knowledge.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="new.html">
<img src="img/view.jpg" width="1500" height="800"/>
<input type="submit" value="开始" />
</form>
</body>
</html>
new.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
var pre = "<img src = 'img/index/";
var suf = ".jpg'/";
var mid = "</img>";
row=97;col=18;
var Row = Math.floor(Math.random()*row+1);
var Col = Math.floor(Math.random()*col+1);
var Str = "";
Str += "<img src='img/di.png' '/>"+select(Row)+"</img>"+"<img src='img/hang.png' >"+"<img src='img/di.png' '/>"+select(Col)+"</img>"+"<img src='img/lie.png'/>";
document.write(Str);
function select(num){
var str = num.toString();
var res = "";
for(var i=0;i<str.length;i++){
var c = str.charAt(i);
res = res + pre + c + suf + mid;
}
console.log(num);
return res;
}
</script>
</body>
</html>
网友评论