首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java相关 >

初学者~ JAVA随即内容调用

2012-09-08 
菜鸟求助~~~ JAVA随即内容调用这是原来的代码。。htmlheadtitle随机文字/title/headbodyscrip

菜鸟求助~~~ 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>

热点排行