主题:  关于JS的问题,请大家帮忙改一下!

zhangweiqian627

职务:普通成员
等级:1
金币:0.0
发贴:17
#12004/4/8 11:27:44
document.write("'<div id="oDiv" style="borderutset 2px;background-color:buttonface;width:120;position:absolute;left:0px;top:0px;visibility:hidden" onmouseout="this.style.visibility='hidden';oDiv2.style.visibility='hidden'" >";
document.write("<table border=0 cellpadding=6 cellspacing=0 width="100%" onmouseover="oDiv.style.visibility='visible'">";
document.write("<tr>";
document.write("<td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';alert('hello A')">ridincal A";
document.write("</td>";
document.write("</tr>";
document.write("<tr>";
document.write("<td class='mOut' onmouseover="this.className='mOver';showSubMenu1(this,2);" onmouseout="this.className='mOut'">ridincal B1 >>";
document.write("</td>";
document.write("</tr>";
document.write("<tr>";
document.write("<td class='mOut' onmouseover="this.className='mOver2';" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';alert('hello W')">ridincal W";
document.write("</td>";
document.write("</tr>";
document.write("</table>";
document.write("</div>";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <LINK REL=STYLESHEET TYPE="text/css" HREF="external/style.css">
    <script type="text/javascript" src="external/jslay.js"></script>
    <!meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>二级菜单</title>
</head>



<div id="oDiv" style="borderutset
2px;background-color:buttonface;width:120;position:absolute;left:0px;top:0px;visibility:hidden"
onmouseout="this.style.visibility='hidden';oDiv2.style.visibility='hidden'" >

        <table border=0 cellpadding=6 cellspacing=0 width="100%" onmouseover="oDiv.style.visibility='visible'">
                <tr>
                <td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';alert('hello A')">ridincal A
                </td>
                </tr>
                <tr>
                <td class='mOut' onmouseover="this.className='mOver';showSubMenu1(this,2);" onmouseout="this.className='mOut'">ridincal B1 >>
                </td>
                </tr>
                <tr>
                <td class='mOut' onmouseover="this.className='mOver2';" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';alert('hello W')">ridincal W
                </td>
                </tr>
        </table>
</div>

<div id="oDiv2" style="borderutset
2px;background-color:buttonface;width:100;position:absolute;left:0px;top:0px;visibility:hidden"
onmouseout="oDiv.style.visibility='hidden';this.style.visibility='hidden'" onmouseover="oDiv.style.visibility='visible'">

    <table border=0 cellpadding=6 cellspacing=0 width="100%" onmouseover="oDiv2.style.visibility='visible'">
            <tr>
            <td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden';alert('hello C')">ridincal C
            </td>
            </tr>
            <tr>
            <td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden';alert('hello D')">ridincal D
            </td>
            </tr>
            <tr>
            <td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden';alert(this.name)">ridincal E
            </td>
            </tr>
    </table>
</div>


<body onload="getmenu()" onclick="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden'">
Hello World!
</body>
</html>
我想把中间的<div 。。。。。></div>写成文件形式,然后用<script type="text/javascript" src="external/menu.js"></script>来调用,但不好用!请您帮帮忙改改,我对document.write()不熟!
以下是被写成的menu.js文件
document.write("<div id="oDiv2" style="borderutset 2px;background-color:buttonface;width:100;position:absolute;left:0px;top:0px;visibility:hidden" onmouseout="oDiv.style.visibility='hidden';this.style.visibility='hidden'" onmouseover="oDiv.style.visibility='visible'">";
document.write("<table border=0 cellpadding=6 cellspacing=0 width="100%" onmouseover="oDiv2.style.visibility='visible'">";
document.write("<tr>";
document.write("<td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden';alert('hello C')">ridincal C";
document.write("</td>";
document.write("</tr>";
document.write("<tr>";
document.write("<td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden';alert('hello D')">ridincal D";
document.write("</td>";
document.write("</tr>";
document.write("<tr>";
document.write("<td class='mOut' onmouseover="this.className='mOver'" onmouseout="this.className='mOut'" onmousedown="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden';alert(this.name)">ridincal E";
document.write("</td>";
document.write("</tr>";
document.write("</table>";
document.write("</div>";



zhangweiqian627

职务:普通成员
等级:1
金币:0.0
发贴:17
#22004/4/8 11:29:29
顺便说一下,menu.js在这里调用不好用:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <LINK REL=STYLESHEET TYPE="text/css" HREF="external/style.css">
    <script type="text/javascript" src="external/jslay.js"></script>
    <!meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>二级菜单</title>
</head>

<script type="text/javascript" src="external/menu.js"></script>

<body onload="getmenu()" onclick="oDiv.style.visibility='hidden';oDiv2.style.visibility='hidden'">
Hello World!
</body>
</html>