我正在处理登录表单。这是代码
<?php
require_once('../../SfHelper.php');
$sfHelper = new SfHelper();
echo $sfHelper->load_css('ui-lightness/login');
?>
<div name="form_Login" class="form_Login">
<form id="form1" name="form1" method="post" action="<?php echo
$sfHelper->base_url().'forms/jobseeker/'; ?>process_Login.php" >
<table width="296" border="0" align="center" cellspacing="5">
<tr>
<td colspan="3">LOGIN JOB SEEKER</td>
</tr>
<tr>
<td width="110">Username</td>
<td width="18">:</td>
<td width="209"><input type="text" name="txtUsername"
id="txtUsername" /></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input type="password" name="txtPassword" id="txtPassword" /></td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td colspan="3"><div align="center">
<input type="submit" name="Login" id="Login" value="Login" />
</div></td>
</tr>
</table>
</form>
</div>
<?php
if(isset($_GET['err']))
{
if($_GET['err'] == "Sorry, We Cannot found your Username")
{
echo '<script type="text/javascript">
alert("Sorry, We Cannot found your Username"); </script>';
}
else if($_GET['err'] == "Invalid Username or Password")
{
echo '<script type="text/javascript">
alert("Invalid Username or Password");</script>';
}
}
?>
问题是我需要使用 jquery 模式对话框而不是使用警报来显示错误消息。我对使用 jquery 一无所知,也不知道我已经掌握了 php 或 javascript。谁能告诉我它是怎么做的?
我已经修改了我的代码并添加了
if(isset($_GET['err']))
{
if($_GET['err'] == "Sorry, We Cannot found your Username")
{
echo '<script type="application/javascript">
$("#Login").click(function() {
$( "#dialog-message" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>';
}
else if($_GET['err'] == "Invalid Username or Password")
{
echo '<script type="application/javascript">
$("#Login").click(function() {
"#dialog-message2" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>';
}
}
这是登录失败时要显示的 div
<div id="dialog-message" style="display:none" >
<p>
<span class="ui-icon ui-icon-circle-check"
style="float:left; margin:0 7px 50px 0;"></span>
Sorry, We Cannot found your Username
</p>
</div>
<div id="dialog-message2" style="display:none" >
<p>
<span class="ui-icon ui-icon-circle-check"
style="float:left; margin:0 7px 50px 0;"></span>
Invalid Username or Password
</p>
</div>
它似乎不起作用。谁能告诉我我哪里做错了?