div隐藏 怎么弄 HTML 希望给HTML代码
我只会ASP.NET(C#)+SQLHTML 不会  希望谁能给出原代码实现功能就是 移动到一个BUTTON 控件上 使DIV隐藏

解决方案 »

  1.   

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    <SCRIPT language="javascript"> 
    function Display(sid) 
    { if (sid.style.display == "none") 

    sid.style.display="";
    }else{ 
    sid.style.display="none";


    </SCRIPT> 
    </head>
    <body>
    <input type=button value="显示与隐藏" onclick="Display(form1)" />
        <form id="form1" runat="server">
        <div>
        div div this is div .........
        </div>
        <table>
        <tr>
        <td><div>+</div></td>
        <td>45454545</td>
        </tr>
        </table>
        </form>
    </body>
    </html> 
      

  2.   

    也可以这样
    其实最主要的就是设置div1.style.display <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无&#26631;&#39064;&#39029;</title>
    <SCRIPT language="javascript"> 
    function Display(sid) 
    { if (document.all.div1.style.display == "none") 

    document.all.div1.style.display="block";
    }else{ 
    document.all.div1.style.display="none";


    </SCRIPT> 
    </head>
    <body>
    <input type=button value="&#26174;示与&#38544;藏" onclick="Display(form1)" />
        <form id="form1" runat="server">
        <div id="div1">
        sdfasdfsadfsdfsdfsdafsdfsadf
        </div>
        <table>
        <tr>
        <td><div>+</div></td>
        <td>45454545</td>
        </tr>
        </table>
        </form>
    </body>
    </html> 
      

  3.   

    style.display = "none 或 display"
      

  4.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>无标题页 </title>    <script language="javascript">  
            function display(id)  
                {  
                    var div=document.getElementById(id);
                    div.style.display="none"; 
                }  
            function show(id)  
                {  
                    var div=document.getElementById(id);
                    div.style.display=""; 
                }  
        </script></head>
    <body>
        <form id="form1" runat="server">
            <input type="button" value="隐藏" onmousemove="display('div1');" onmouseout ="show('div1');" />
            <div id="div1">
                <strong>呵呵...
                    <br />
                    我胡汉三又回来了. </strong>
            </div>
        </form>
    </body>
    </html>
      

  5.   

    public partial class Default3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
         this.ImageButton1.Attributes.Add("onmouseover", "change()");
         this.ImageButton2.Attributes.Add("onmouseover", "reset()");
           
        }
    }
    //HTML里面 
    <script type="text/javascript">
    function change() 
            { 
                document.form1.all["ImageButton1"].src="images/3223.bmp";//改变图片地址
                document.form1.all["ImageButton2"].src="images/3223.bmp"; //改变图片地址
                document.getElementById("HyperLink1").innerText = "aaa"; //改变text文本值
                document.getElementById("ImageButton3").style.display="none";//隐藏控件
     
                
            }
    function reset() 
            { 
                document.form1.all["ImageButton1"].src="images/333.bmp";//改变图片地址
                document.form1.all["ImageButton2"].src="images/333.bmp"; //改变图片地址
                document.getElementById("HyperLink1").innerText = "aaa"; //改变text文本值
                document.getElementById("ImageButton3").style.display="block";//隐藏控件 
            }         
            </script>
    我移动到ImageButton1上事件能触发  为什么移动到ImageButton2上面  ImageButton2对应的事件不会被触发
      

  6.   

    这样做也能满足你的要求:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DIVControl._Default" %><!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 runat="server">
        <title>Untitled Page</title>
        <script language="javascript" type="text/javascript">
        function view()
        {
            document.getElementById("myDiv").style.visibility="visible";
        }
        function hide()
        {
            document.getElementById("myDiv").style.visibility="hidden";
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <center>
        <asp:Button ID="ControlDiv" name="ControlDiv" runat="server" Text="把鼠标移上来看看" onmouseover="view();" onmouseout="hide();" />
        <div id="myDiv" style="background-color:Gray; width:128px; height:56px; text-align: center; visibility:hidden" >你好!我是隐藏的DIV
        </div>
        </center>
        </div>
        </form>
    </body>
    </html>
      

  7.   

    我题目问的问题 不用解答了!!!!!!!!!!!!!!!谁帮我解答下 我现在做的问题??????????????<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><!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 runat="server">
        <title>无标题页</title>
    </head><script type="text/javascript">
    function change() 
            { 
                document.form1.all["ImageButton1"].src="images/3223.bmp";//改变图片地址
                document.form1.all["ImageButton2"].src="images/3223.bmp"; //改变图片地址
                document.getElementById("HyperLink1").innerText = "aaa"; //改变text文本值
                document.getElementById("ImageButton3").style.display="none";//隐藏控件
                
     
                
            }
    function reset() 
            { alert("2");
                document.form1.all["ImageButton1"].src="images/333.bmp";//改变图片地址
                document.form1.all["ImageButton2"].src="images/333.bmp"; //改变图片地址
                document.getElementById("HyperLink1").innerText = "aaa"; //改变text文本值
                document.getElementById("ImageButton3").style.display="block";//隐藏控件 
            }         
            </script>
    <body>
        <form id="form1" runat="server">
        
        <div>
            <asp:ImageButton ID="ImageButton1" runat="server" Height="38px" Style="z-index: 100;
                left: 13px; position: absolute; top: 17px" Width="81px" />
            <asp:HyperLink ID="HyperLink1" runat="server" Height="30px" NavigateUrl="~/Default.aspx"
                Style="z-index: 101; left: 16px; position: absolute; top: 80px" Width="154px">asasa</asp:HyperLink>
            <asp:ImageButton ID="ImageButton2" runat="server" Height="35px" Style="z-index: 102;
                left: 137px; position: absolute; top: 15px" Width="83px" />
            <asp:ImageButton ID="ImageButton3" runat="server" Height="75px" Style="z-index: 104;
                left: 166px; position: absolute; top: 110px" Width="102px" />
        
        </div>
        </form>
    </body>
    </html>using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;public partial class Default3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
         this.ImageButton1.Attributes.Add("onmouseover", "change()");
         this.ImageButton2.Attributes.Add("onmouseover", "reset()");
         
            
        }
    }为什么只有ImageButton1有触发,ImageButton2触发不了
      

  8.   

    按道理是不会不触发的,是不代码哪错了?或者你没有在ImageButton2注册事件
      

  9.   

    楼主这样做应该可以触发到啊,代码也看不出哪错,唉,水平有限。楼主试一下直接到ImageButton2里注册事件
    不在后台注册试试。也许是在ImageButton1触发之后ImageButton2改变了
      

  10.   

    document.all.div1.style.display="block"; //显示
    document.all.div1.style.display="none"; //隐藏////完整的HTML代码如下
    <script>
    function ShowDiv()
    {
      var div_obj=document.getElementById("your_div_id");
      div_obj.style.display="block";
    }
    </script>
    <div id="your_div_id" style="display:none;">This is a message!</div>
    <input type="button" onmouseover="ShowDiv();" value="显示层" />
      

  11.   

    隐藏层:<script>
    function HideDiv()
    {
      var div_obj=document.getElementById("your_div_id");
      div_obj.style.display="none";
    }
    </script>
    <div id="your_div_id" style="display:block;">This is a message!</div>
    <input type="button" onmouseover="HideDiv();" value="隐藏" />
    关键就是DIV的style设置,你可以用javascript对其进行任何style属性的设置,甚至可以移动div
    还有就是常用的HTML控件事件,如本例的onmouseover做BS开发的,HTML一定要花点心思了解了解咯,还有JavaScript也非常重要。
    建议看看 http://www.w3school.com.cn/tags/html_ref_eventattributes.asp 
      

  12.   

    看12楼的.想隐藏div只要通过id获取这个div然后把他的style.display="none"就行了.
      

  13.   

    这么多,肯定看晕搂主了,我想搂主有必要看看css!
      

  14.   

    div_id.style.display = "none";
      

  15.   

    div_id.style.display = "none";
      

  16.   

    上面的问题我已经解决了             char a=document.form1.all["ImageButton4"].src.value;
                
               if(a=="images/xinyongdangan.jpg")
    {
    //我写的代码}HTML 里面 格式不对,正确写法是什么?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
      

  17.   

    chara== “images/xinyongdangan.jpg" 好像不管怎么看这里的格式都有问题啊。
      

  18.   

    char a== “images/xinyongdangan.jpg" 好像不管怎么看这里的格式都有问题啊。
      

  19.   

    你这是后台代码啊,又不前台的,HTML很宽松的,只要不报错,你就用呗
      

  20.   

    dddddddddddddddddddddddddddddddddddddddddd
      

  21.   

    把 reset() 这个方法名改一下,这个词应该是关键词