这是我的代码,我将Try it按钮设置为再次打开对话框,但它不起作用! 在加载页面我希望它关闭,在我按下试试,然后我想打开这个对话框,PLZ帮助我< 3
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
$(function() {
$( "#dialog" ).dialog();
});
</script>
</head>
<body>
<button onclick="dialog">Try it</button>
<div id="dialog" title="Regjistro Window te ri">
<?php
// if there are any errors, display them
if ($error != '')
{
echo '<div style="padding:4px; border:1px solid red; color:red;">'.$error.'</div>';
}
?>
<center><span style="color: gray">Mbaj mend te dhenat!</span></center><br>
<form action="" method="post">
<center>
<table>
<tr>
<td>Emri:</td> <td><input type="text" size="15" name="uname" value="<?php echo $uname; ?>"/></td>
</tr>
<tr>
<td>Password:</td> <td><input type="text" size="15" name="password" value="<?php echo $password; ?>"/></td>
</tr>
<tr>
<td></td><td><input type="submit" name="submit" value=" Kalo "></td>
</tr>
</table>
<center>
</form>
</div>
答案 0 :(得分:0)
请尝试以下操作:
将按钮代码更改为:
<button id="theButton">Try it</button>
和你的脚本:
<script>
$(function() {
var theDialog=$( "#dialog" ).dialog({autoOpen:false});
$("#theButton").click(function(evt){
theDialog.dialog('open');
});
});
</script>