2
我想用动态的div内容显示对话框,在div里面我试图添加跨度,文本框和按钮,但Jquery的对话框不displaying.Help我在这个问题上动态股利内容jQuery的对话框
预先感谢您的回答
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Jquery Dynamic Div</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="JQUERY/jquery-ui.js"></script>
<style type="text/css">
.ui-datepicker
{
width: 17.5em;
height: 16.6em;
font-size:12.5px;
margin-left: 120px;
z-index: 1000;
}
</style>
<script type="text/javascript">
$(document).ready(function()
{
$("#btnSubmit").click(function()
{
alert("inside");
var DynamicDiv = $('<div id="ExpiryDatePopup" style="display:block;width:680px;height:327px;background-color:#FFFFFF;></div>');
alert("Div Created");
var breakTag1 = $('</br>');
alert("Div Created");
var breakTag2 = $('</br>');
var ExpDateText = $('<span style="color: steelblue;margin-left: 55px;">Please enter the Expiration Date </span>');
var EndDateText = $('<span style="margin-left: 56px;position: relative;">End Date</span><span style="color: #f00">*</span>');
var DatePickerText = $('<input type="text" id="datepicker" readonly="true" style="margin-left:32px" style="margin-left: 59px;margin-top: 29px;position: static;top: 85px;"/>');
var SubMitButton = $('<input type="button" id="popUpSubmit" value="Submit" style="margin-left: 128px;margin-top: 78px;height: 28px;width: 82px;" />');
alert("Div Created");
$('body').append(DynamicDiv);
$('#ExpiryDatePopup').append(breakTag1);
$('#ExpiryDatePopup').append(breakTag2);
$('#ExpiryDatePopup').append(breakTag1);
$('#ExpiryDatePopup').append(ExpDateText);
$('#ExpiryDatePopup').append(DatePickerText);
$('#ExpiryDatePopup').append(SubMitButton);
alert("hi sam");
$('#ExpiryDatePopup').dialog(
{
height: 400,
width: 600,
title: 'Expiration Date',
position: 'center',
background: 'red',
opacity: '0.3',
modal: true,
open: function()
{
$("#datepicker").datepicker({ dateFormat: 'yy-mm-dd',
minDate: dateToday,
showOn: 'button',
buttonText: 'Show Date',
buttonImageOnly: true,
buttonImage: 'Images_/icon_calendar.jpg'
});
}
});
});
});
</script>
</head>
<body>
<input type="button" id="btnSubmit" value="Submit"/>
</body>
</html>
A
回答
0
以及我曾尝试你的代码和它的工作对我来说很好。
唯一的问题是创建<div id="ExpiryDatePopup"></div>
您忘记关闭ExpiryDatePopup
DIV style属性。
测试的代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Jquery Dynamic Div</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<style type="text/css">
.ui-datepicker
{
width: 17.5em;
height: 16.6em;
font-size:12.5px;
margin-left: 120px;
z-index: 1000;
}
</style>
<script type="text/javascript">
$(document).ready(function()
{
$("#btnSubmit").click(function()
{
var DynamicDiv = $('<div id="ExpiryDatePopup" style="display:block;width:680px;height:327px;background-color:#FFFFFF;" /></div>');
var breakTag1 = $('</br>');
var breakTag2 = $('</br>');
var ExpDateText = $('<span style="color: steelblue;margin-left: 55px;">Please enter the Expiration Date </span>');
var EndDateText = $('<span style="margin-left: 56px;position: relative;">End Date</span><span style="color: #f00">*</span>');
var DatePickerText = $('<input type="text" id="datepicker" readonly="true" style="margin-left:32px" style="margin-left: 59px;margin-top: 29px;position: static;top: 85px;"/>');
var SubMitButton = $('<input type="button" id="popUpSubmit" value="Submit" style="margin-left: 128px;margin-top: 78px;height: 28px;width: 82px;" />');
$('body').append(DynamicDiv);
$('#ExpiryDatePopup').append(breakTag1);
$('#ExpiryDatePopup').append(breakTag2);
$('#ExpiryDatePopup').append(breakTag1);
$('#ExpiryDatePopup').append(ExpDateText);
$('#ExpiryDatePopup').append(DatePickerText);
$('#ExpiryDatePopup').append(SubMitButton);
$('#ExpiryDatePopup').dialog(
{
height: 400,
width: 600,
title: 'Expiration Date',
position: 'center',
background: 'red',
opacity: '0.3',
modal: true,
open: function()
{
$("#datepicker").datepicker({ dateFormat: 'yy-mm-dd',
minDate: dateToday,
showOn: 'button',
buttonText: 'Show Date',
buttonImageOnly: true,
buttonImage: 'Images_/icon_calendar.jpg'
});
}
});
});
});
</script>
</head>
<body>
<input type="button" id="btnSubmit" value="Submit"/>
</body>
</html>
您还可以创建DIV您忘记关闭样式属性的错误。
0
相关问题
- 1. 带动态内容的jQuery对话框
- 2. dojo对话框动态内容2
- 3. 动态内容的jQuery文件另存为对话框
- 4. 股利不与内容
- 5. 内容进行股利
- 6. 加入jQuery的内容装载到现有股利内容
- 7. 股利对齐内部的
- 8. 滚动到动态股利
- 9. JQuery UI对话框无法动态加载页面内容?
- 10. 动态jQuery对话框
- 11. jquery动态对话框
- 12. 添加股利各地动态HTML列表内容
- 13. jQuery UI对话框 - 更改打开对话框(Ajax)的内容
- 14. 刷新jQuery UI对话框的内容
- 15. CSS保持股利的内容
- 16. jquery对话框插件内容大小
- 17. jQuery UI对话框添加内容
- 18. Jquery加载()内容到对话框()
- 19. 股利不会自动扩大,由于动态加载的内容
- 20. 对齐股利
- 21. jQuery UI的动态对话框
- 22. jquery datepicker模态对话框内
- 23. 股利内容消失约出现
- 24. 拆分股利内容分成两行
- 25. 生成表对话框内容滚动
- 26. 将活动内容带到对话框
- 27. jQuery UI对话框的内容在填充后向上移动
- 28. 动画调整jQuery对话框的内容
- 29. 动态对话框
- 30. 的jQuery ::滚动股利不工作
'变种DynamicDiv = $( '
你刚开任何错误?? – bipen 2013-02-20 12:05:36
你检查我的答案? – 2013-02-20 12:08:25