jQuery 弹出模态窗口

chl19871024 2010-01-14 12:07:47
jQuery 弹出模态窗口后我如何 能让jQuery获取的模态窗口里的属性进行判断
例如
	<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<link rel="stylesheet" href="themes/main.css" type="text/css" />
<link rel="Shortcut Icon" href="img/Leicester-City-256x256.ico">
<!--tipswindown插件样式-->
<link rel="stylesheet" href="themes/tipswindown.css" type="text/css" />
<script src="jsa/jquery.min.js" type="text/javascript"></script>
<script src="jsa/tipswindown.js" type="text/javascript">//tipswindown插件</script>
<script src="jsa/jq-main.js" type="text/javascript"></script>
</head> <button id="id1">点击我弹出提示</button>
<div id="testID" style="display: none">
<table>
<tr>
<td><input type="text" id="name" /></td>
<td><input type="text" id="pass" /></td>
<input type="button" value="验证"/>
</tr>
</table>
</div>
</li>

当我单击按钮Button的时候将会弹出个窗口里面包含着 两个文本框 我该如何去写才能验证两个文本框不能为空呢?
...全文
2804 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
caixinbo_007 2011-05-27
  • 打赏
  • 举报
回复
为什么恢复了才给看呢。。
mykelly6 2010-02-22
  • 打赏
  • 举报
回复
没看出来你这个哪里用到模态窗口了,貌似是点击button显示一个隐藏的div而已。
这样子的通过id应该直接就取到了啊

弹出的模态窗口验证的话,在弹出页面里写js验证就可以了
造化玉蝶 2010-02-19
  • 打赏
  • 举报
回复
唉 很难看到正确答案
itliyi 2010-01-14
  • 打赏
  • 举报
回复

$(function(){
$("input[type=\"button\"]:eq(0)").click(function() {//第几个按钮
//var str="";
$("input[type=\"text\"]").each(function(index, value) {
if (value.value == "") {
alert("不能为空");
value.focus();
return;
}
//str += "<value" + index + ">" + value.value + "</value" + index + ">";
});
});

});
itliyi 2010-01-14
  • 打赏
  • 举报
回复

$("input[type=\"button\"]:eq(0)").click(function() {//第几个按钮
//var str="";
$("input[type=\"text\"]").each(function(index, value) {
if (value.value == "") {
alert("不能为空");
value.focus();
return;
}
//str += "<value" + index + ">" + value.value + "</value" + index + ">";
});
});
chl19871024 2010-01-14
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 itliyi 的回复:]
设置相应事件
[/Quote]
取不到里面的 ID!
设置哪些事件?
itliyi 2010-01-14
  • 打赏
  • 举报
回复
设置相应事件
chl19871024 2010-01-14
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 happy002 的回复:]
弹出的模态窗口相当于这个窗口的子窗口

window.opener.document.getElementById('').value
[/Quote]
这样取不出来对象。
chl19871024 2010-01-14
  • 打赏
  • 举报
回复


主要是我刚学这个。。 哎。。。
itliyi 2010-01-14
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 caoyuminqq 的回复:]
jquery模态窗体

$.prompt('确定要更新吗?',{ callback: function(v,m,f){
    if(v==true)
    {
      $.get("chalidindex.aspx", { mid:ajaxs.sysid,id:mid,mname:mname,mtaix:mtaix,murl:murl, msg:'update',time:new Date() },
        function(data){
          $("#msg").html("");
          $("#msg").html(data);
    });
[/Quote]学习
caoyuminqq 2010-01-14
  • 打赏
  • 举报
回复
jquery模态窗体

$.prompt('确定要更新吗?',{ callback: function(v,m,f){
if(v==true)
{
$.get("chalidindex.aspx", { mid:ajaxs.sysid,id:mid,mname:mname,mtaix:mtaix,murl:murl, msg:'update',time:new Date() },
function(data){
$("#msg").html("");
$("#msg").html(data);
});
itliyi 2010-01-14
  • 打赏
  • 举报
回复
我之前的可以
chl19871024 2010-01-14
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 itliyi 的回复:]
var clk=function(){
$("input[type=\"button\"]:eq(0)").click(function() {//第几个按钮
        //var str="";
        $("input[type=\"text\"]").each(function(index, value) {
            if (value.value == "") {
                alert("不能为空");
                value.focus();
                return;
            }
            //str += " <value" + index + ">" + value.value + " </value" + index + ">";
        });
    });

}
$(function(){clk();});
///加载后再调用
只会这样了
[/Quote]


还是不行 但是谢谢啦!
liuzhiyuymm 2010-01-14
  • 打赏
  • 举报
回复
学习了.
itliyi 2010-01-14
  • 打赏
  • 举报
回复
var clk=function(){
$("input[type=\"button\"]:eq(0)").click(function() {//第几个按钮
//var str="";
$("input[type=\"text\"]").each(function(index, value) {
if (value.value == "") {
alert("不能为空");
value.focus();
return;
}
//str += "<value" + index + ">" + value.value + "</value" + index + ">";
});
});

}
$(function(){clk();});
///加载后再调用
只会这样了
itliyi 2010-01-14
  • 打赏
  • 举报
回复
写成一个函数
加载时候调用 弹出窗体之后再调用
happy002 2010-01-14
  • 打赏
  • 举报
回复
弹出的模态窗口相当于这个窗口的子窗口

window.opener.document.getElementById('').value
chl19871024 2010-01-14
  • 打赏
  • 举报
回复
我测试了下 那样只会在 页面加载的时候弹出对话框 但是 弹出窗口之后 就获取不到里面的值了。
chl19871024 2010-01-14
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 itliyi 的回复:]
JScript code
$(function(){
$("input[type=\"button\"]:eq(0)").click(function() {//第几个按钮//var str=""; $("input[type=\"text\"]").each(function(index, value) {if (value.value=="") {
?-
[/Quote]
还是 无反应。。。。

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧