我把js直接加到html中可以正常显示,但是如果把相同的js代码做成一个js文件然后从html导入,也就是从html中导入外部的js文件,却无法正常显示,有报错说第3XX行少了个\')\',但是我觉得代码是没错的,你知道是什么原因?
其实即使首页大一点也没有关系,因为网页是php代码生成的,事实上浏览器也只需要导入一次代码就可以了,不过还是用外部js比较好控制,以后修改起来也方便阿~
<script language=\"JavaScript\" src=\" js文件的地址\" type=\"text/JavaScript\"></script>
你的js文件首尾就不用加
<script language=\"JavaScript\">和</script>了
是这样吗?应该没问题吧
或者文件里不小心删掉了一个引号?
文件down了,导航栏正常,但是图象无法正常显示(路径是对的),看来这个导航栏真的没法用了。我只有二级菜单,给我看看那个js吧~不想用dw重做了~
:glare::( 不好意思啊~~我那个js也是这个人做的(就是说也要用DW),只不过算是你用的那个的前一个版本~~~
------------
var mmenus = new Array();
var misShow = new Boolean();
misShow=false;
var misdown = new Boolean();
misdown=false;
var msrcel;
var mfromel;
var mtoel;
var musestatus=false;
var mthestatus=\"\";
var mpopTimer = 0;
mmenucolor=\'#000000\';mfontcolor=\'#ffffff\';mmenuoutcolor=\'#ffffff\';mmenuincolor=\'#ffffff\';mmenuoutbordercolor=\'#666666\';mmenuinbordercolor=\'#666666\';mmidoutcolor=\'#ff0000\';mmidincolor=\'#ff0000\';mmenuovercolor=\'#000000\';mitemedge=\'0\';msubedge=\'1\';mmenuunitwidth=60;mmenuitemwidth=160;mmenuheight=22;mmenuwidth=\'500\';mmenuadjust=5;mmenuadjustV=-5;mfonts=\'font-family: 宋体; font-size: 9pt; color: #FFFFFF; \';mcursor=\'default\';
function stoperror(){
return true;
}
window.onerror=stoperror;
function mpopOut() {
mpopTimer = setTimeout(\'mallhide()\', 500);
}
function getReal(el, type, value) {
temp = el;
while ((temp != null) && (temp.tagName != \"BODY\")) {
if (eval(\"temp.\" + type) == value) {
el = temp;
return el;
}
temp = temp.parentElement;
}
return el;
}
function mMenuRegister(menu)
{
mmenus[mmenus.length] = menu
return (mmenus.length - 1)
}
function mMenuItem(caption,command,target,isline,statustxt,img,sizex,sizey,pos){
this.caption=caption;
this.command=command;
this.target=target;
this.isline=isline;
this.statustxt=statustxt;
this.img=img;
this.sizex=sizex;
this.sizey=sizey;
this.pos=pos;
}
function mMenu(caption,command,target,img,sizex,sizey,pos){
this.items = new Array();
this.caption=caption;
this.command=command;
this.target=target;
this.img=img;
this.sizex=sizex;
this.sizey=sizey;
this.pos=pos;
this.id=mMenuRegister(this);
}
function mMenuAddItem(item)
{
this.items[this.items.length] = item
item.parent = this.id;
this.children=true;
}
mMenu.prototype.addItem = mMenuAddItem;
function mtoout(src){
src.style.borderLeftColor=mmenuoutbordercolor;
src.style.borderRightColor=mmenuinbordercolor;
src.style.borderTopColor=mmenuoutbordercolor;
src.style.borderBottomColor=mmenuinbordercolor;
src.style.backgroundColor=mmenuoutcolor;
src.style.color=mmenuovercolor;
}
function mtoin(src){
src.style.borderLeftColor=mmenuinbordercolor;
src.style.borderRightColor=mmenuoutbordercolor;
src.style.borderTopColor=mmenuinbordercolor;
src.style.borderBottomColor=mmenuoutbordercolor;
src.style.backgroundColor=mmenuincolor;
src.style.color=mmenuovercolor;
}
function mnochange(src){
src.style.borderLeftColor=mmenucolor;
src.style.borderRightColor=mmenucolor;
src.style.borderTopColor=mmenucolor;
src.style.borderBottomColor=mmenucolor;
src.style.backgroundColor=\'\';
src.style.color=mfontcolor;
}
function mallhide(){
for(var nummenu=0;nummenudocument.body.clientWidth)
menuid.style.left=document.body.clientWidth-mmenuitemwidth;
menuid.style.visibility=\'visible\';
misShow=true;
}
function mmenu_over(menuid,x){
mtoel = getReal(window.event.toElement, \"className\", \"coolButton\");
mfromel = getReal(window.event.fromElement, \"className\", \"coolButton\");
if (mtoel == mfromel) return;
msrcel = window.event.srcElement;
if(x mallhide();
mtoin(msrcel);
mmenushow(menuid,eval(\"mMenu\"+x));
}
clearTimeout(mpopTimer);
}
function mmenu_out(menuid){
mtoel = getReal(window.event.toElement, \"className\", \"coolButton\");
mfromel = getReal(window.event.fromElement, \"className\", \"coolButton\");
if (mtoel == mfromel) return;
msrcel = window.event.srcElement;
if (misShow){
mtoin(msrcel);
}else{
mnochange(msrcel);
}
mpopOut()
}
function mmenu_down(menuid,x){
msrcel = getReal(window.event.srcElement, \"className\", \"coolButton\");
if(misShow){
mmenuhide(menuid);
mtoout(msrcel);
}
else{
mtoin(msrcel);
mmenushow(menuid,eval(\"mMenu\"+x));
misdown=true;
}
}
function mmenu_up(){
misdown=false;
}
function mmenuitem_over(menuid){
msrcel = getReal(window.event.srcElement, \"className\", \"coolButton\");
if(misdown){
mtoin(msrcel);
}
else{
mtoout(msrcel);
}
if(mthestatus!=\"\"){
musestatus=true;
window.status=mthestatus;
}
clearTimeout(mpopTimer);
}
function mmenuitem_out(menuid){
msrcel = getReal(window.event.srcElement, \"className\", \"coolButton\");
mnochange(msrcel);
if(musestatus)window.status=\"\";
mpopOut()
}
function mmenuitem_down(menuid){
msrcel = getReal(window.event.srcElement, \"className\", \"coolButton\");
mtoin(msrcel)
misdown=true;
}
function mmenuitem_up(menuid){
msrcel = getReal(window.event.srcElement, \"className\", \"coolButton\");
mtoout(msrcel)
misdown=false;
}
function mexec2(x){
var cmd;
if(mmenus
- .target==\"blank\"){
cmd = \"window.open(\'\"+mmenus - .command+\"\')\";
}else{
cmd = mmenus - .target+\".location=\'\"+mmenus
- .command+\"\'\";
}
eval(cmd);
}
function mexec(x,i){
var cmd;
if(mmenus - .items.target==\"blank\"){
cmd = \"window.open(\'\"+mmenus- .items.command+\"\')\";
}else{
cmd = mmenus- .items.target+\".location=\'\"+mmenus
- .items.command+\"\'\";
}
eval(cmd);
}
function mbody_click(){
if (misShow){
msrcel = getReal(window.event.srcElement, \"className\", \"coolButton\");
for(var x=0;x\'
for(var x=0;x\"+ifspace+thismenu.caption+\"\";
}else if(thismenu.pos==\"1\"){
stringx += \" align=center>\"+thismenu.caption+ifspace+\"\";
}else if(thismenu.pos==\"2\"){
stringx += \" align=center background=\"+thismenu.img+\">\"+thismenu.caption+\"\";
}else{
stringx += \" align=center>\"+thismenu.caption+\"\";
}
stringx += \"\";
}
stringx+=\" \";
for(var x=0;x\';
}else{
stringx+=\'\\n\'+
\'\\n\'
for(var i=0;i\"+ifspace+thismenuitem.caption+\"\";
}else if(thismenuitem.pos==\"1\"){
stringx += \">\"+thismenuitem.caption+ifspace+\"\";
}else if(thismenuitem.pos==\"2\"){
stringx += \"background=\"+thismenuitem.img+\">\"+thismenuitem.caption+\"\";
}else{
stringx += \">\"+thismenuitem.caption+\"\";
}
}else{
stringx+=\'\\n\';
}
}stringx+=\'\\n\'
}
}
document.write(\"\"+stringx+\"\");
break
}
}
}
function document_load(){
mwritetodocument();
}mpmenu1=new mMenu(\'首页\',\'../../index.htm\',\'self\',\'回首页\',\'\',\'\',\'\',\'\');
mpmenu1.addItem(new mMenuItem(\'音乐小站\',\'../musicmain.htm\',\'self\',false,\'音乐小站\',\'\',\'\',\'\',\'\'));
mpmenu1.addItem(new mMenuItem(\'暂无\',\'\',\'\',\'\',\'\',\'\',\'\'));
mpmenu1.addItem(new mMenuItem(\'暂无\',\'\',\'\',\'\',\'\',\'\',\'\',\'\'));
mpmenu1.addItem(new mMenuItem(\'关于祺\',\'javascript:alert(\"未完成\")\',\'self\',false,\'未完成\',\'\',\'\',\'\',\'\'));
mpmenu2=new mMenu(\'Enigma相关\',\'\',\'self\',\'\',\'\',\'\',\'\');
mpmenu2.addItem(new mMenuItem(\'Biography\',\'bio.htm\',\'self\',false,\'Biography For Enigma and Michael Cretu\',\'\',\'\',\'\',\'\'));
mpmenu2.addItem(new mMenuItem(\'已出专辑\',\'disco.htm\',\'self\',false,\'未完成\',\'\',\'\',\'\',\'\'));
mpmenu2.addItem(new mMenuItem(\'有关评论\',\'wenzhai.htm\',\'self\',false,\'一些抄来的文章\',true));
mpmenu2.addItem(new mMenuItem(\'歌词\',\'1st.htm\',\'blank\',false,\'歌词\',\'\',\'\',\'\',\'\'));
mpmenu2.addItem(new mMenuItem(\'相关链接\',\'links.htm\',\'self\',false,\'提供一些相关网站\',\'\',\'\',\'\',\'\'));
mpmenu3=new mMenu(\'友情链接\',\'../../links.htm\',\'blank\',false,\'\',\'\',\'\',\'\');
mpmenu3.addItem(new mMenuItem(\'成都七中未来梦\',\'http://www.cdqz.com\',\'blank\',false,\'我的高中^_^\',\'\',\'\',\'\',\'\'));
mpmenu3.addItem(new mMenuItem(\'高中校友录\',\'flydae4120.alumni.chinaren.com\',\'blank\',false,\'Sohu上的校友录\',\'\',\'\',\'\',\'\'));
mpmenu3.addItem(new mMenuItem(\'摇友之家\',\'http://www.rockbbs.com\',\'blank\',false,\'摇友之家\',\'\',\'\',\'\',\'\'));
mpmenu3.addItem(new mMenuItem(\'古墓丽影专题站论坛\',\'http://www.lara.com.cn\',\'blank\',false,\'劳拉,我的最爱^_^\',\'\',\'\',\'\',\'\'));
mpmenu3.addItem(new mMenuItem(\'更多......\',\'../../links.htm\',\'blank\',false,\'更多友情链接\',\'\',\'\',\'\',\'\'));
mpmenu4=new mMenu(\'联系祺\',\'\',\'self\',\'\',\'\',\'\',\'\');
mpmenu4.addItem(new mMenuItem(\'QQ:10173015\',\'\',\'\',false,\'QQ:10173015\',\'\',\'\',\'\',\'\'));
mpmenu4.addItem(new mMenuItem(\'E-mail Me\',\'mailto:subaru_00@msn.com\',\'self\',false,\'给我写Email\',\'\',\'\',\'\',\'\'));
mpmenu4.addItem(new mMenuItem(\'给我留言\',\'http://www.0044.net/index.asp?boardID=1948\',\'blank\',false,\'从申请的留言板\',\'\',\'\',\'\',\'\'));
----------------------
上面的用引用
然后在紧接一句document_load()
但是这个我在你的最初那个页面上试过,仍然不行