日期:2014-05-20  浏览次数:20700 次

菜鸟求助~~~ JAVA随即内容调用
这是原来的代码。。

<html>
<head>
<title>随机'文字</title>
</head>
<body>
<script language="JavaScript">
<!-- Hide
var a = Math.random() + ""
var rand1 = a.charAt(5)
quotes = new Array
quotes[1] = '文字一'
quotes[2] = '文字二'
quotes[3] = '文字三'
quotes[4] = '文字四'
quotes[5] = '文字五'
quotes[6] = '文字六'
quotes[7] = '文字七'
quotes[8] = '文字八'
quotes[9] = '文字九'
quotes[0] = '文字十'
var quote = quotes[rand1]
//-->
</script>
<script language="JavaScript">
<!-- Hide
document.write( quote )
//-->
</script>
</body>
</html>

应该如何改才能给“文字X”加入超链接呢?谢谢了!~~

------解决方案--------------------
<html>
<head>
<title>随机'文字</title>
</head>
<body>
<script language="JavaScript">
<!-- Hide
var a = Math.random() + ""
var rand1 = a.charAt(5)
quotes = new Array
quotes[1] = '文字一'
quotes[2] = '文字二'
quotes[3] = '文字三'
quotes[4] = '文字四'
quotes[5] = '文字五'
quotes[6] = '文字六'
quotes[7] = '文字七'
quotes[8] = '文字八'
quotes[9] = '文字九'
quotes[0] = '文字十'
var quote = "<a href='" + quotes[rand1] + "'>" + quotes[rand1] + "</a>"; 
//-->
</script>
<script language="JavaScript">
<!-- Hide
document.write( quote )
//-->
</script>
</body>
</html>