微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – 组合框在警报即将到来时消失

在我的jsp页面中,我有一个文本框和两个组合框.当我在文本框中写东西时,我的jsp页面中会出现警报.警报即将出现,因为“用户名已经存在”,并且警告文本框自动刷新但两个组合框消失了为什么?我无法找出可能有什么帮助的原因吗?我在头部包括以下内容.警报的完整来源是here.

http://csscody.com/demo/wp-content/demo/popup/js/jquery.easing.1.3.js

http://csscody.com/demo/wp-content/demo/popup/js/alertbox.js

http://csscody.com/demo/wp-content/demo/popup/js/style.css

<html>
<head>
    <Meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <SCRIPT type="text/javascript" src="js/jquery.min.js"></SCRIPT>
<SCRIPT type="text/javascript" src="js/jquery.easing.1.3.js"></SCRIPT>
<SCRIPT type="text/javascript" src="js/alertBox.js"></SCRIPT>
<LINK rel="stylesheet" type="text/css" media="all" href="js/style.css">

    <script type="text/javascript">
          $(document).ready(function() {
           $("#textBox").keyup(function () {
    $.getJSON('check.jsp', {
        textBoxname: this.value
    },function(data){
      if(data.isTrue){
          $("#textBox").val(''); //clear the text Box
          csscody.alert("username already exists");// here alert is coming
                 }
      else{
      }
     });
});
});
    </script>
 </head>
<body>
        <input type="text" id="textBox" name="textBoxname" style="position: absolute; width: 250px; left: 110px; top: 40px;" />
<br/><br/>

// The following two combo Boxes are getting vanished after alert why
<select id="" name="" style="position: absolute; left: 600px; top: 40px; width: 250px;">
     <option value=""></option>
      <option value="somedata">somedata</option>
          </select>
<br/><br/> 
<select id="" >
    <option value="_"></option>
     <option value="somedata">somedata</option>
        </select>
 </body>
</html>

check.jsp

JSONObject jsonObj= new JSONObject(); 
jsonObj.put("isTrue","true");
response.setContentType("application/json");
response.getWriter().write(jsonObj.toString());

解决方法:

你的代码都可以.当我开始调试代码时,我在alertBox.js中看到了一些有趣的东西:(第141和178行)

  if (!$.support.maxHeight) { //IE6
              $('embed, object, select').css({ 'visibility' : 'hidden' });
  }

代码检测ie6(如果读取评论),但似乎是它的错误.

只需注释这些行,您的问题就会得到解决.

并且不要忘记发布此错误
祝好运.并开始使用调试器:)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐