gpt4 book ai didi

javascript - 警报到来时组合框消失

转载 作者:太空宇宙 更新时间:2023-11-04 14:45:03 25 4
gpt4 key购买 nike

在我的 jsp 页面中,我有一个文本框和两个组合框。当我在文本框中写东西时,我的 jsp 页面中出现警报。警报出现为“用户名已存在”,警报后文本框自动刷新但两个组合框消失了,为什么?我找不到任何帮助的原因可能是什么?我在 head 部分包含了以下内容。警报的完整来源是 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>

检查.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(如果阅读评论)但似乎有问题。

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

别忘了发布这个错误!祝你好运。并开始使用调试器:)

关于javascript - 警报到来时组合框消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9347654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com