我的网页不能正常显示(含有javascript的部分)
发布网友
发布时间:2024-10-03 14:10
我来回答
共1个回答
热心网友
时间:2024-10-04 23:31
已经修改好了,你可以复制直接保存为HTML格式,代码如下:
<html>
<head>
<title>龙腾天下-longtengtianxia</title>
<script type="text/javascript">
<!-- Hide the script from old browsers
function getQuote()
{
quotes=new Array(4);
sources=new Array(4);
quotes[0]="when i was a boy of 14,my father was so ignorant..." +
"but when i got to be 21,i was astonished at how much he had learned"+
"in 7 years.";
sources[0]="mark twain";
quotes[1]="everybody is ugnorant. only on different subjects.";
sources[1]="will rogers";
quotes[2]="they say such nice things about people at their funerals "+
"that it makes me sad that i 'm going to miss mine by just a few days.";
sources[2]="garrison keilor";
quotes[3]="what's anotther word for whesaurus? ";
sources[3]="wanglei";
i=Math.floor(Math.random()*quotes.length);
document.write("<dl style='background-color:#EEEEEE'>\n");
document.write("<dt>"+"\"<"+i+">"+quotes[i]+"</i>\"\n"); //这里是你错误的地方
document.write("<dd>"+"-"+sources[i]+"\n"); //还有这里,请仔细对比一下
document.write("<dl>\n");
}
</script>
</head>
<body>
<h1>quotabe quotes<h1>
<p>
please!
</p>
<script type="text/javascript">
<!--Hide the script from old browsers
getQuote();
</script>
</body>
</html>