小编che*_*bli的帖子

单击"搜索"按钮后未收到客户端消息

我正在努力alpha.dubaiexporters.com.有一个搜索面板包含两个输入关键字和类别.我想验证关键字部分.

如果用户输入少于三个字符并单击"搜索"按钮,则应显示客户端消息the entered input should be more than 3 characters.我没有收到客户留言.

以下是我的代码:

<input type="text" id="txtkeyword" name="s" runat="server" autocomplete="off">
<asp:Button ID="Search" class="dt-header-search-submit dt-button dt-button-danger" style="top:0px;width:226px;height:70px;" Text="Search" runat="server" onclick="doit" OnClientClick="return checkLength();" />
Run Code Online (Sandbox Code Playgroud)

以下是我的Javascript:

<script type="text/javascript">
        function checkLength() {
            var textbox = document.getElementById("txtkeyword");
            if (textbox.value.length < 3) {
                alert("The entered input should be 3 or more than 3 characters");
                return false;
            }
        }
    </script>
Run Code Online (Sandbox Code Playgroud)

代码背后:

protected void doit(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(txtkeyword.Value))
        {
            try
            {

                String mainsearch1 = …
Run Code Online (Sandbox Code Playgroud)

javascript c# asp.net validation

5
推荐指数
1
解决办法
77
查看次数

如何在任何地方点击外面关闭div?

我正在使用alpha.dubaiexporters.com.

http://alpha.dubaiexporters.com/aboutus.aspx
Run Code Online (Sandbox Code Playgroud)

点击一个go按钮,会出现一个搜索面板,我可以在其中执行搜索关键字和类别.

问题是 after clicking on go button, search panel appears but if the user does not want to perform any search, he clicks outside anywhere but that search panel does not go.

我尝试了下面的代码,我写了javascript代码,但它没有用.

<header class="header vc_row-fluid vc_col-sm-12">
<div class="top-header vc_col-sm-12">
<div class="logo shadows vc_col-sm-3">
<a href="Default.aspx"><img src="images/layout/check1.png" width="230" height="69" alt="Dubai Exporters" /></a></div>
<div class="menu-btn icon-menu-1"></div>

<div class="header_search"><div class="search sb-search" id="sb-search">
    <div class="gray-form">
<input type="text" name="s" class="footer_search_input" onclick="clearInput(this, 'Search');" value="Search" />
<input type="submit" name="search" class="btn btn-primary sb-search-submit" value="Search" /> …
Run Code Online (Sandbox Code Playgroud)

javascript c#

5
推荐指数
1
解决办法
101
查看次数

标签 统计

c# ×2

javascript ×2

asp.net ×1

validation ×1