<DIV id="site_<%=S_Temp.getID()%>" onmouseover="setDivDisplay('<%=S_Temp.getID()%>')" onmouseout="setDivHide('<%=S_Temp.getID()%>')"style="z-index:3; width:500; height:15; position:absolute; top:<%=Y%>px; left:<%=X%>px; color:<%=S_color%>; font-weight:bold; font-size:9pt; text-align:left"><img src="images/<%=S_color%>.gif"><%=S_Temp.getName()%>&nbsp;</DIV>                                在上面的S_Temp.getID=  5001的 
因为点位很多
我不能写很多 下面的 代码,该怎样改写成这样的呢
<script language="javascript">
//显示菜单
function setDivDisplay(divName) {
    var v = document.getElementById(divName);
    var e = window.event;    

    if ( v.style.left === "" ){
        v.style.left = (e.clientX - 50) + "px";
    }
    
    if (v.style.top === "") {
        v.style.top = (e.clientY + 1) + "px";
    }
    
    v.style.visibility = "visible";
   
    
}
function setDivHide(divName) {
    var v = document.getElementById(divName);
    v.style.visibility = "hidden";
}</script>
就是下面写成函数的
<%
 checkS_siteid="5001";
 ResultSet rs;
        ZDSqlString="select top 8 INFECTANT_NAME,ACTUAL_VALUE,INFECTANT_UNIT from V_HE_SHI_NOW where site_id='"+checkS_siteid+"' order by sampling_datetime desc";
           rs=query.getResult(ZDSqlString);  
%>
<DIV id=<%=checkS_siteid%> onmouseover="setDivDisplay('<%=checkS_siteid%>')" onmouseout="setDivHide('<%=checkS_siteid%>')" style="position:absolute;visibility:hidden;" style="z-index:3; width:500; height:15;   font-weight:bold; font-size:9pt; position:absolute; text-align:left">
        <TABLE border="0" cellpadding="0" cellspacing="1" style="FILTER:Alpha(Opacity=80,style=0);">
<%while(rs.next()) {
   
   String S_INFECTANT_NAME=rs.getString("INFECTANT_NAME");
   String S_ACTUAL_VALUE=rs.getString("ACTUAL_VALUE");
   String S_INFECTANT_UNIT=rs.getString("INFECTANT_UNIT");
   %>
  
            <TR>
                <TD ><strong><%=S_INFECTANT_NAME%></strong></TD>
                <TD ><strong><%=S_ACTUAL_VALUE%></strong></TD>
<TD ><strong><%=S_INFECTANT_UNIT%></strong></TD>
            </TR>            
<% }%>
        </TABLE>
    </DIV>  请高手帮下忙了