请大家帮忙看下这段Javascript代码 可以放到JS 文件里面引用吗 该怎么调用?
不太懂这,请大家赐教 代码如下:
------------------------------------------------------
<HTML> <HEAD> <TITLE> |> 2222 </TITLE>
<META http-equiv=Content-Type content= "text/html; charset=gb2312 ">
!-- 网站统一样式 --> <LINK href= "qz.files/87846.htm " type=text/css
rel=stylesheet> <!-- 亲子乐一级栏目统一样式 --> <LINK href= "qz.files/mybaby.css "
type=text/css rel=stylesheet>
</HEAD>
<BODY>
<!--计数器-->
<!--head 结束--> <!--main 开始-->
<DIV id=main>
<DIV class=bg> <!--main01 开始-->
<DIV id=left> <!-- left bar star-->
<DIV id=left_bar>
<SCRIPT language=javascript type=text/javascript>
<!--left bar 统一表现层js-->
//@06.07.18
//main programe
function show(action,channel_num,start_index,root_length){
for(var n=start_index;n <root_length;n++){
document.getElementById( 'root '+n).style.display = 'block ';
try{document.getElementById( 'sub '+n).style.display = 'none ';}
catch(e){}
}
if (action== 'open '){
document.getElementById( 'root '+channel_num).style.display = 'none ';
document.getElementById( 'sub '+channel_num).style.display = 'block ';
}
else{
document.getElementById( 'sub '+channel_num).style.display = 'none ';
document.getElementById( 'root '+channel_num).style.display = 'block ';
}
}
//add channel for data
//参数opened 是否展开栏目
function add_channel(name, url, opened) {
this.opened = (opened==true) ? true : false;
this.name = name;
this.url = url;
this.sub_channel = new Array();
}
//when onmouseover, then change_class this background( just class name)
function change_class(object,class_name){
object.className=class_name;
}
//show 栏目
//参数 start_index 根目录开始索引数值
//参数 root_length 根目录数组长度
function show_menu(start_index,root_length)
{
<!--menu star-->
document.write( ' <div class= "menu "> ');
for (var i=start_index;i <root_length;i++){
if (root[i].sub_channel.length!=0)
{
document.write( ' <div id= "root '+i+ ' " class= "root_close_onmouseout " onmouseover= "change_class(this,\ 'root_close_onmouseover\ ') " onmouseout= "change_class(this,\ 'root_close_onmouseout\ ') " ');
if ( root[i].opened==true ) {document.write( 'style= "display:none; " ');}
document.write( '> <a href= "javascript:show(\ 'open\ ', '+i+ ', '+start_index+ ', '+root_length+ '); " title= " '+openTitle+ ' " target= "_self "> <div class= "root_array "&