日期:2014-05-17  浏览次数:21172 次

div显示与隐藏的问题
当载入网页时,从网址上得到参数xxx,并根据xxx的值判断是否显示div中的内容。
====================代码==================
<%
dim   xxx
xxx=request.QueryString( "xxx ")
if   xxx <> " "   then
response.Write " <script   language= " "javascript " ">   jncg.style.display= " "none " ";   </script>   "
end   if
%>

<div   id= "jncg ">
.......
</div>

------解决方案--------------------
你要在 window 的 onload 中去隐藏.


最好是用 jquery
<%
dim xxx
dim isShow
xxx=request.QueryString( "xxx ")
if xxx <> " " then
isShow= "show "
else
isShow= "hide "
endif
%>
<script type= "text/javascript " src= "http://code.jquery.com/jquery-latest.pack.js "> </script>
<script type= "text/javascript " language= "JavaScript ">

$(document).ready(function(){
$( "#jncg "). <%=isShow%> ();
});
</script>

<div id= "jncg ">
.......
</div>

------解决方案--------------------
<%
dim xxx
xxx=request.QueryString( "xxx ")
if xxx <> " " then

%>
<script language= " "javascript " ">
jncg.style.display=none;
</script> "
<%
end if
%>

<div id= "jncg ">
.......
</div>