首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

javascipt有关问题,点击按钮显示DIV,然后DIV中有一个关闭按钮,关闭时DIV上文本框无法关闭

2012-05-24 
javascipt问题,点击按钮显示DIV,然后DIV中有一个关闭按钮,关闭时DIV上文本框无法关闭javascipt问题,点击按

javascipt问题,点击按钮显示DIV,然后DIV中有一个关闭按钮,关闭时DIV上文本框无法关闭
javascipt问题,点击按钮显示DIV,然后DIV中有一个关闭按钮,关闭时DIV上文本框无法关闭,如何解决这个问题,代码如下:

<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "test.aspx.cs "   Inherits= "test "   %>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   id= "Head1 "   runat= "server ">
        <title> Untitled   Page </title>
        <script   language= "javascript ">

        function   test()
        {
        var   strInfoContext;
      strInfoContext   =   " <div   id= 'diplayinpoi '   style= 'POSITION:   absolute;   width:295px;height:158px;Z-INDEX:   100; '> ";





strInfoContext   +=   " <div   id= 'displayall '   style= 'LEFT:   7px;   WIDTH:   283px;   POSITION:   absolute;   TOP:   6px;   HEIGHT:   159px;   BACKGROUND-COLOR:   #ffffff '> ";


       
        strInfoContext   += " <div   id= 'divToName '   style= 'visibility:visible; '> <input   type= 'text '   name= 'txtStart '   style= 'width:   100px '/>   vvvv </div> ";

strInfoContext   +=   " </div> ";
strInfoContext   += " <input   type= 'button '     value= '关闭 '   style= 'RIGHT:   10px;   POSITION:   absolute;   TOP: '   onclick= 'hiddeinfo() '/> ";

strInfoContext   +=   " </div> ";

     

                document.getElementById( "div1 ").innerHTML=strInfoContext;
                  document.getElementById( "div1 ").style.visibility   =   'visible ';
        }
        function   vvv()
        {
                document.getElementById( "divToName ").style.visibility= "visible ";
        }
        function   vvv1()
        {
                document.getElementById( "divToName ").style.visibility= "hidden ";
        }
        function   hiddeinfo()
        {

               
               
                document.getElementById( "div1 ").style.visibility   =   "hidden ";
               
               
        }

        </script>


       
</head>
<body   >
        <form   id= "form1 "   runat= "server ">
        <div   id= "div1 "   style= "visibility:hidden ">
               
                       
                      </div>

                <input   id= "Button1 "   type= "button "   value= "btnview "     onclick= "test(); "/>
        </form>
</body>
</html>


[解决办法]
请把这段代码
strInfoContext += " <div id= 'divToName ' style= 'visibility:visible; '> <input type= 'text ' name= 'txtStart ' style= 'width: 100px '/> vvvv </div> ";
里面的
style= 'visibility:visible; '
去掉,就可以了。



[解决办法]
strInfoContext += " <div id= 'divToName ' style= 'display:block; '> <input type= 'text ' name= 'txtStart ' style= 'width: 100px '/> vvvv </div> ";

change the code to like that,don 't use visibility,because it is not for this requirement

i try it,that is ok,good luck
[解决办法]
document.getElementById( "divToName ").style.display = "none ";
document.getElementById( "divToName ").style.display = "block ";


把你的改成以上標準寫法

热点排行