javaScript中连接问题?
我在网上下了一个菜单特效但是不知道怎么修改超链接
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
</head>
<body>
<table width= "200 " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
脚本说明:
把如下代码加入区域中
<style>
<!--
a.parentlink { text-decoration: none; color: #333333; font-size: 12px }
a.parentlink:hover,a.childlink:hover { color: #000000; }
a.childlink,td.childlink { text-decoration: none; color: #666666; font-size: 12px }
.px7 { font-size: 7px; vertical-align: middle; }
-->
</style>
<script language=javascript>
var item_num=5; //父层菜单的行数
var item_word=new Array(); //菜单的文字
for(i=0;i <item_num;i++)
item_word[i]=new Array();
item_word[0][0]= "修改 ";
item_word[0][1]= "修改 ";
item_word[0][2]= "修改 ";
item_word[1][0]= "添加教师 ";
item_word[1][1]= "删除教师 ";
item_word[1][2]= "修改教师信息 ";
item_word[2][0]= "添加学生 ";
item_word[2][1]= "删除学生 ";
item_word[2][2]= "修改学生信息 ";
item_word[3][0]= "添加课程信息 ";
item_word[3][1]= "删除课程信息 ";
item_word[3][2]= "修改课程信息 ";
var item_link=new Array(); //菜单的链接
for(i=0;i <item_num;i++)
item_link[i]=new Array();
item_link[0][0]= "javascript: ";
item_link[0][1]= "javascript: ";
item_link[0][2]= "javascript: ";
item_link[1][1]= "javascript: ";
item_link[1][2]= "javascript: ";
item_link[2][0]= "javascript: ";
item_link[2][1]= "javascript: ";
item_link[1][0]= "javascript: ";
item_link[2][2]= "javascript: ";
item_link[3][0]= "javascript: ";
item_link[3][1]= "javascript: ";
item_link[3][2]= "javascript: ";
var item=new Array(); //菜单的HTML
for(i=0;i <item_num;i++)
item[i]= " ";
for(i=0;i <item_num;i++)
for(j=0;j <item_word[i].length;j++)
item[i]+= " | <span class=px7> -● </span> <a class=childlink href= "+item_link[i][j]+ " onclick=javascript:this.blur();> "+item_word[i][j]+ " </a> <br> ";
//------------定义一个清空各菜单的函数--------------
function startItem()
{
for(i=0;i <item_num;i++)
document.all.titem.cells[2*i+1].innerHTML= " ";
}
//------------------定义结束----------------------
//------------定义一个菜单展开的函数----------------
function openItem(n)
{
if(document.all.titem.cells[n*2+1].innerHTML== " ")
{
startItem();
document.all.titem.cells[n*2+1].innerHTML=item[n];
}
else
startItem();
}
//------------------定义结束----------------------
//-----------------开始实现菜单-------------------
document.writeln( " <table id=titem> ");
document.writeln( " <tr> <td height=20 valign=bottom> <span class=px7> ● </span> <a class=parentlink href=javascript: onclick=javascript:openItem(0);this.blur();> 文章管理 </a> </td> </tr> ");
document.writeln( " <tr> <td class=childlink> </td> </tr> ");
document.writeln( " <tr> <td height=20 valign=bottom> <span class=px7> ● </span> <a class=parentlink href=javascript: onclick=javascript:openItem(1);this.blur();> 教师管理 </a> </td> </tr> ");
document.writeln( " <tr> <td class=childlink> </td> </tr> ");
document.writeln( " <tr> <td height=20 valign=bottom> <span class=px7> ● </span> <a class=parentlink href=javascript: onclick=javascript:openItem(2);this.blur();> 学生管理 </a> </td> </tr> ");
document.writeln( " <tr> <td class=childlink> </td> </tr> ");
document.writeln( " <tr> <td height=20 valign=bottom> <span class=px7> ● </span> <a class=parentlink href=javascript: onclick=javascript:openItem(3);this.blur();> 课程管理 </a> </td> </tr> ");
document.writeln( " <tr> <td class=childlink> </td> </tr> ");
document.writeln( " <tr> <td height=20 valign=bottom> <span class=px7> ● </span> <a class=parentlink href=javascript: onclick=javascript:openItem(4);this.blur();> 退出系统 </a> </td> </tr> ");
document.writeln( " <tr> <td class=childlink> </td> </tr> ");
document.writeln( " <tr> <td class=childlink> </td> </tr> ");
document.writeln( " </table> ");
//------------------菜单结束-----------------------
</script>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
摆脱个为:
item_link[0][0]= "javascript: ";
item_link[0][1]= "javascript: ";
item_link[0][2]= "javascript: ";
item_link[1][1]= "javascript: ";
item_link[1][2]= "javascript: ";
item_link[2][0]= "javascript: ";
item_link[2][1]= "javascript: ";
item_link[1][0]= "javascript: ";
item_link[2][2]= "javascript: ";
item_link[3][0]= "javascript: ";
item_link[3][1]= "javascript: ";
item_link[3][2]= "javascript: ";这个地方应该加什么?
[解决办法]
太长了吧
[解决办法]
就像這樣子,加上URL就OK了
...
item_link[0][0]= "http://www.csdn.net ";
.....