我认为我为此错过了一些作品。我对JavaScript和JQuery有点陌生,之前有人尝试提供帮助,但是他们的解决方案也不起作用。

我需要类似于该站点上的下拉导航效果:
professional-painters.com,然后单击“快速联系”

由于某些原因,Contact不会切换。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="DaVincisApp1.WebForm2" %>

<!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>
<link href="~/Styles/StyleSheet1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<%--<script type="text/javascript" src="Scripts/motion.js"></script>--%>
<script type="text/javascript">
    $(document).ready(function(){     /* make sure the contact form is hidden when the page loads: */     $('div#contact-form').hide();      $('a#contact-button').toggle(function(){         /* slides the contact form down and shows it */         $('div#contact-form').slideDown();     }, function () {         /* hides it again */         $('div#contact-form').slideUp();     } }
);</script>
</head>
<body>
<div id="nav">
    <div id="navigation-primary">
        <ul>
            <li><a href="#">Menu 1</a></li>
            <li><a href="#">item 2</a></li>
            <li><a href="#">Menuitem 3</a></li>
            <li><a id="contact-button" href="#">Contact</a></li>
        </ul>
        <div id="contact-form">
            <form action="#" method="post">
            <div class='hiddenFields'>
                <input type="hidden" name="ACT" value="20" />
                <input type="hidden" name="URI" value="index" />
                <input type="hidden" name="XID" value="1c46d517779f90c9f5a13bac8338968a3c2b9d16" />
                <input type="hidden" name="status" value="open" />
                <input type="hidden" name="return" value="consultation/thank_you" />
                <input type="hidden" name="redirect_on_duplicate" value="" />
                <input type="hidden" name="RET" value="http://professional-painters.com/" />
                <input type="hidden" name="form_name" value="Quick" />
                <input type="hidden" name="id" value="freeform" />
                <input type="hidden" name="params_id" value="136390" />
                <input type="hidden" name="site_id" value="1" />
            </div>
            <fieldset style="padding: 7px;">
                <table id="quickcontact-in">
                    <tr>
                        <td>
                            <input tabindex="1" class="field" type="text" name="name" value="Name" onfocus="if (this.value == 'Name') this.value = '';"
                                onblur="if (this.value == '') this.value = 'Name';" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input tabindex="2" class="field" type="text" name="email" value="Email address"
                                onfocus="if (this.value == 'Email address') this.value = '';" onblur="if (this.value == '') this.value = 'Email address';" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input tabindex="3" class="field" type="text" name="phone1" value="Phone (optional)"
                                onfocus="if (this.value == 'Phone (optional)') this.value = '';" onblur="if (this.value == '') this.value = 'Phone';" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <textarea tabindex="4" class="txtField" cols="4" rows="4" name="comments">Questions or Comments</textarea>
                        </td>
                    </tr>
                     <tr>
                        <td>
                            <div id="submit">
                                <input tabindex="6" type="submit" name="submit" value="Send Request" />
                            </div>
                            <p class="tiny" align="right">
                                <a href="javascript:;" onmousedown="toggleSlide('quickcontact');">Close</a></p>
                        </td>
                    </tr>
                </table>
            </fieldset>
            </form>
        </div>
    </div>
</div>
</body>
</html>

#navigation-primary {
/*background: url("/img/nav_back.gif") repeat-x scroll 0 0 #61533F;*/
background-color: Red;
left: 0;
position: absolute;
top: 46px;
z-index: 1;
}

#nav {
height: 34px;
width: 878px;
}

#contact-button a {
/*background: url("/img/nav_contact.gif") no-repeat scroll 0 0 transparent;*/
background-color: Green;
width: 109px;
}

#quickcontact {
background: none repeat scroll 0 0 #666449;
border-left: 2px solid #3D352B;
color: #FFFFFF;
padding: 10px;
position: absolute;
right: 0;
text-align: left;
top: 75px;
width: 245px;
z-index: 1000;
}

#quickcontact-in a {
color: #FFFFFF;
}

#quickcontact fieldset {
border: medium none;
}

#quickcontact-in .field {
background: none repeat scroll 0 0 #FEFBD5;
border: 2px solid #FFF1BD;
color: #666666;
padding: 2px;
width: 190px;
}

#quickcontact-in .txtField {
background: none repeat scroll 0 0 #FEFBD5;
border: 2px solid #FFF1BD;
color: #666666;
display: block;
float: left;
font: 1em "Lucida Sans Unicode",Verdana,Arial,Helvetica,sans-serif;
height: 90px;
margin: 5px 0 7px;
outline: medium none;
padding: 2px;
width: 190px;
}

最佳答案

快速混搭示例here。我认为您可以使用slideToggle()。有关更多示例,请参见here

07-24 17:23