我想要这个:
http://jqueryui.com/demos/dialog/#modal-message
当您点击 ClickMe 时发生。
如何做到这一点?
<script type="text/javascript">
$(document).ready(function() {
$('div.thedialog').dialog({ autoOpen: false })
$('#thelink').click(function(){ $('div.thedialog').dialog('open'); });
}
</script>
</head>
<body>
<div id="thedialog" title="Download complete">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Your files have downloaded successfully into the My Downloads folder.
</p>
<p>
Currently using <b>36% of your storage space</b>.
</p>
</div>
<a href="#" id="thelink">Clickme</a>
什么都没发生
最佳答案
不要使用 div.thedialog
,而是使用 div#thedialog
。 .
与类名一起使用,#
在使用 ids 时使用。
(另外,如果这是您使用的实际代码,则缺少括号:))
工作代码:
<!doctype html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/ui-lightness/jquery-ui.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('div#thedialog').dialog({ autoOpen: false })
$('#thelink').click(function(){ $('div#thedialog').dialog('open'); });
})
</script>
</head>
<body>
<div id="thedialog" title="Download complete">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Your files have downloaded successfully into the My Downloads folder.
</p>
<p>
Currently using <b>36% of your storage space</b>.
</p>
</div>
<a href="#" id="thelink">Clickme</a>
</body>
关于jquery 模式对话框 onclick?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2353037/