0

这是我的代码,我设置了 Try it 按钮以再次打开对话框,但它不起作用!在加载页面时我希望它关闭,在我按下 Try it 之后,我想打开这个对话框,PLZ HELP ME <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>
4

1 回答 1

0

试试这个:

将按钮的代码更改为:

<button id="theButton">Try it</button>

和你的脚本:

<script>
    $(function() {
        var theDialog=$( "#dialog" ).dialog({autoOpen:false});

        $("#theButton").click(function(evt){
             theDialog.dialog('open');
        });
    });
</script>
于 2013-08-25T18:15:43.450 回答