我想实现像csdn.net那样的功能,谁能跟我说说~

junsisi 2002-02-28 12:08:07
就是在csdn.net登陆,如果密码错误,它会自己关闭窗口,这是怎么实现的?
...全文
35 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
junsisi 2002-03-01
  • 打赏
  • 举报
回复
咳,虽然没看明白,但还是感谢!
junsisi 2002-02-28
  • 打赏
  • 举报
回复
不是用脚本~~

因为脚本语言的话,它老是会提示‘是否关闭本窗口’,客户端是可以选择否的!我想像csdn一样,一点提示都没有,错误就关!
咋办?
sain 2002-02-28
  • 打赏
  • 举报
回复
if(错误){
window.close();
}
纪俊 2002-02-28
  • 打赏
  • 举报
回复
倒,用ASP不还是脚本语言...
希偌 2002-02-28
  • 打赏
  • 举报
回复
这段是我写的验证类似代码,无论是否window.open,只要验证不通过都不出现确定框而关闭窗口!不过是php的,你自己改改吧!
<script language=javascript>
<!--
function paste()
{
document.all.content.value=document.all.content.value+"[img][/img]";
document.all.content.focus();
}
function shutwin(){closes.Click();return;}
function Trim(value){
var res = String(value).replace(/^[\s]+¦[\s]+$/g,'');
return res;
}
function submit0()
{
if(Trim(document.inputform.name.value)=="")
{
alert('填入你的名字之后才能发言!');
document.inputform.name.focus();
document.inputform.name.select();
return false;
}
else
if(Trim(document.inputform.content.value)=="")
{
alert('发言内容你还没有填耶!');
document.inputform.content.focus();
document.inputform.content.select();
return false;
}
else
if(document.inputform.email.value != "")
{
var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z])"
var re = new RegExp(regu);
if (document.inputform.email.value.search(re) != -1) {
return true;
} else {
window.alert ("请正确输入电子邮件");
document.inputform.email.focus();
document.inputform.email.select();
return false;
}
}
else
{
return true;
}
}
//-->
</script>
</head>

<body background="index1.jpg" bgproperties=fixed marginwidth="1" marginheight="1">
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
<?php
if(Trim($no)==""||$pass=="")
{
echo "<center><font color=#ff0000>留言编号和密码都不能为空!</font><br>"
?>
<a href="javascript:shutwin();">关闭本窗口</a>
<?
exit;
}
?>
<?php
if(!is_numeric($no))
{
echo "<center><font color=#ff0000>留言编号应该输入整数数字!</font><br>"
?>
<a href="javascript:shutwin();">关闭本窗口</a>
<?
exit;
}
?>
<?php
include("./conn.inc.php");
$result=mysql_query("select * from message where id=".$no,$db);
$result0=mysql_query("select * from admin order by id asc",$db);
$result1=mysql_query("select * from message where hfid=".$no,$db);
$array=mysql_fetch_array($result);
$array0=mysql_fetch_array($result0);
?>
<?php
if(count($array)==1)
{
echo "<center><font color=#ff0000>该留言号不存在!</font><br>"
?>
<a href="javascript:shutwin();">关闭本窗口</a>
<?
exit;
}
?>
<?php
if($pass!=$array[pass]&&$pass!=$array0[pass])
{
echo "<center><font color=#ff0000>密码错误,不能编辑留言!</font><br>"
?>
<a href="javascript:shutwin();">关闭本窗口</a>
<?
exit;
}
?>
<?php
if($sel=='delete')
{
mysql_query("delete from message where id=".$no,$db);
while($array1=mysql_fetch_array($result1))
{
mysql_query("delete from message where hfid=".$no,$db);
}
echo "<script>alert('编号为“".$no."”的留言已经被成功删除!');shutwin();</script>";
exit;
}
?>
julyclyde 2002-02-28
  • 打赏
  • 举报
回复
是脚本
因为身份验证窗口是target="_blank"的,跟window.open的窗口一样,可以直接close而不会提示
lczddd 2002-02-28
  • 打赏
  • 举报
回复
呵呵,不是脚本那如何判断,如何关闭,是脚本!!!

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧