有点击游览器右上角关闭按钮的事件吗? 或者这个按钮的值是什么,可以用CLICK响应吗?

对酒当歌今夕何夕 2005-08-15 03:59:37
问了好几个高人,都说有,找了半天都说没找到

有人说unonload事件,我晕死,刷新窗体这个事件也会被激活的,不能用
而且我的页面是个FRAME的,根本没BODY,unonload都不知道往那里写...

个人以为onclick事件应该可以响应,但是这个游览器最右上边的X按钮是什么呢?
这个应该算HTML吧?

或者知道那里能查这个按钮的值也请告诉我....
...全文
402 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
安迪 2005-08-16
  • 打赏
  • 举报
回复
我想真的可以的话,这可能就是微软的一个大bug了
  • 打赏
  • 举报
回复
to wanghui0380(放歌)
阁下的脚本我还不太清楚怎么样用,但是意思到是明白...

不过看样子的确没有这样的东西...只能放弃了..换解决方案了...结贴了..谢谢
  • 打赏
  • 举报
回复
to ghostzp(mm对我说:有钱就结婚,我没钱!)
原来阁下已经深入研究过鸟...在下拜服...
完全自定义一个窗口...
难道还是只能通过线程的关闭来判断....
似乎也没有其他办法了...这个贴还是结了吧....
这个是写游览器的遗忘了....还是其他什么的...有点想找人投诉一下...
如果有这个事件的话就方便很多了..

wanghui0380 2005-08-16
  • 打赏
  • 举报
回复
这里有一段wsh脚本,综合应用了很多对象,不过这个在ie里可是不可能运行的
set ie=wscript.createobject("internetexplorer.application","event_") '创建ie对象'
ie.menubar=0 '取消菜单栏'
ie.addressbar=0 '取消地址栏'
ie.toolbar=0 '取消工具栏'
ie.statusbar=0 '取消状态栏'
ie.width=400 '宽400'
ie.height=400 '高400'
ie.resizable=0 '不允许用户改变窗口大小'
ie.navigate "about:blank" '打开空白页面'
ie.left=fix((ie.document.parentwindow.screen.availwidth-ie.width)/2) '水平居中'
ie.top=fix((ie.document.parentwindow.screen.availheight-ie.height)/2) '垂直居中'
ie.visible=1 '窗口可见'

with ie.document '以下调用document.write方法,'
.write "<html><body bgcolor=#dddddd scroll=no>" '写一段html到ie窗口中。'
.write "<h2 align=center>远程清除系统日志</h2><br>"
.write "<p>目标IP:<input id=ip type=text size=15>" '也可以用navigate方法直接打开一'
.write "<p>用户名:<input id=user type=text size=30>" '个html文件,效果是一样的。'
.write "<p>密码: <input id=pass type=password size=30>"
.write "<p align=center>类型:" '不仅是input对象,所有DHTML支持'
.write "<input id=app type=checkbox>应用程序 " '的对象及其属性、方法都可以使用。'
.write "<input id=sys type=checkbox>系统 "
.write "<input id=sec type=checkbox>安全" '访问这些对象的办法和网页中访问'
.write "<p align=center><br>" '框架内对象是类似的。'
.write "<input id=confirm type=button value=确定> "
.write "<input id=cancel type=button value=取消>"
.write "</body></html>"
end with

dim wmi '显式定义一个全局变量'
set wnd=ie.document.parentwindow '设置wnd为窗口对象'
set id=ie.document.all '设置id为document中全部对象的集合'
id.confirm.onclick=getref("confirm") '设置点击"确定"按钮时的处理函数'
id.cancel.onclick=getref("cancel") '设置点击"取消"按钮时的处理函数'

do while true '由于ie对象支持事件,所以相应的,'
wscript.sleep 200 '脚本以无限循环来等待各种事件。'
loop

sub event_onquit 'ie退出事件处理过程'
wscript.quit '当ie退出时,脚本也退出'
end sub

sub cancel '"取消"事件处理过程'
ie.quit '调用ie的quit方法,关闭IE窗口'
end sub '随后会触发event_onquit,于是脚本也退出了'

sub confirm '"确定"事件处理过程,这是关键'
with id
if .ip.value="" then .ip.value="." '空ip值则默认是对本地操作'
if not (.app.checked or .sys.checked or .sec.checked) then 'app等都是checkbox,通过检测其checked'
wnd.alert("至少选择一种日志") '属性,来判断是否被选中。'
exit sub
end if
set lct=createobject("wbemscripting.swbemlocator") '创建服务器定位对象'
on error resume next '使脚本宿主忽略非致命错误'
set wmi=lct.connectserver(.ip.value,"root/cimv2",.user.value,.pass.value) '连接到root/cimv2名字空间'
if err.number then '自己捕捉错误并处理'
wnd.alert("连接WMI服务器失败") '这里只是简单的显示“失败”'
err.clear
on error goto 0 '仍然让脚本宿主处理全部错误'
exit sub
end if
if .app.checked then clearlog "application" '清除每种选中的日志'
if .sys.checked then clearlog "system"
if .sec.checked then clearlog "security" '注意,在XP下有限制,不能清除安全日志'
wnd.alert("日志已清除")
end with
end sub

sub clearlog(name)
wql="select * from Win32_NTEventLogFile where logfilename='"&name&"'"
set logs=wmi.execquery(wql) '注意,logs的成员不是每条日志,'
for each l in logs '而是指定日志的文件对象。'
if l.cleareventlog() then
wnd.alert("清除日志"&name&"时出错!")
ie.quit
wscript.quit
end if
next
end sub
lsgis2001 2005-08-16
  • 打赏
  • 举报
回复
关注中,学习一下。
  • 打赏
  • 举报
回复
没人看.... 我UP
若白师妹 2005-08-16
  • 打赏
  • 举报
回复
我研究到今天都没研究出来,如果你研究出来请告诉我
我会的只有2个办法,一是象fangq(停不下的脚步)说的在网页上放个关闭按钮让用户去按关闭触发我们定义的事件,如果用户不去按那个按钮关闭,那么就没办法了
二是自己写个模拟的,自己看吧:save as html
<HTML XMLNS:IE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<IE:Download ID="include" STYLE="behavior:url(#default#download)" />
<title>Programmed By Ghost</title>

<SCRIPT LANGUAGE="JScript">

var CW_width = 800; //这里设置窗口宽度
var CW_height = 600; //这里设置窗口高度
var CW_top =100; //这里设置窗口离显示器顶部多少,
var CW_left =10; //离显示器左边距离
var CW_url = "/";
var New_CW = window.createPopup();
var CW_Body = New_CW.document.body;
var content = "";
var CSStext = "margin:1px;color:black; border:2px outset;border-style:expression(onmouseout=onmouseup=function(){this.style.borderStyle='outset'}, onmousedown=function(){if(event.button!=2)this.style.borderStyle='inset'});background-color:buttonface;width:16px;height:14px;font-size:12px;line-height:11px;cursor:Default;";
//上而样式啦....
//Build Window
include.startDownload(CW_url, function(source){content=source});

function insert_content(){
var temp = "";
CW_Body.style.overflow = "hidden";
CW_Body.style.backgroundColor = "aliceblue"; //改背景色,可以改为背景,如何你会CSS
CW_Body.style.border = "solid black 1px"; //边框样式
content = content.replace(/<a ([^>]*)>/g,"<a onclick='parent.open(this.href);return false' $1>");
temp += "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>";
temp += "<tr style=';font-size:12px;height:20;cursor:default' ondblclick=\"Max.innerText=Max.innerText=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_CW();\" onmouseup='parent.drag_up(event)' onmousemove='parent.drag_move(event)' onmousedown='parent.drag_down(event)' onselectstart='return false' oncontextmenu='return false'>";
temp += "<td id=msviRegionGradient1 style=';FILTER: progid:DXImageTransform.Microsoft.Gradient(startColorStr=navy, endColorStr=#ADCBF7, gradientType=1);color=white;padding-left:5px;'>Windows Programmed By Ghost                                                                                            "; //这里是TITLEBAR

temp += "<span id=Help onclick=\"alert('Programmed By Ghost- Ver 1.0\\n\\npublic for you\\n\\n1999-2004 版权所有')\" style=\""+CSStext+"font-family:System;padding-right:2px;\">?</span>"; // 这儿是版权,就是那个?号点一下
//出来的.
temp += "<span id=Min onclick='parent.New_CW.hide();parent.blur()' style=\""+CSStext+"font-family:Webdings;\" title='Minimum'>0</span>";
temp += "<span id=Max onclick=\"this.innerText=this.innerText=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_CW();\" style=\""+CSStext+"font-family:Webdings;\" title='Maximum'>1</span>";
temp += "<span id=Close onclick='parent.opener=null;parent.close()' style=\""+CSStext+"font-family:System;padding-right:2px;\" title='Close'>x</span>";
temp += "</td></tr><tr><td colspan=2>";
temp += "<div id=include style='overflow:scroll;overflow-x:hidden;overflow-y:auto; HEIGHT: 100%; width:"+CW_width+"'>";
temp += content;
temp += "<font style='font-size:9px'>How are you?<br><%=date%><font></div>"; //主页面内容,如果把这个页做成ASP的,那显示的内容就丰富啦
temp += "</td></tr>";
temp +="</table>";
CW_Body.innerHTML = temp;
}

//setTimeout("insert_content()",1000);
insert_content()
var if_max = true;
function show_CW(){
window.moveTo(10000, 10000);
if(if_max){
New_CW.show(CW_top, CW_left, CW_width, CW_height);
if(typeof(New_CW.document.all.include)!="undefined"){
New_CW.document.all.include.style.width = CW_width;
New_CW.document.all.Max.innerText = "1";
}

}else{
New_CW.show(0, 0, screen.width, screen.height);
New_CW.document.all.include.style.width = screen.width;
}
}

window.onfocus = show_CW;
window.onresize = show_CW;

// Move Window
var drag_x,drag_y,draging=false

function drag_move(e){
if (draging){
New_CW.show(e.screenX-drag_x, e.screenY-drag_y, CW_width, CW_height);
return false;
}
}

function drag_down(e){
if(e.button==2)return;
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height)return;
drag_x=e.clientX;
drag_y=e.clientY;
draging=true;
e.srcElement.setCapture();
}

function drag_up(e){
draging=false;
e.srcElement.releaseCapture();
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height) return;
CW_top = e.screenX-drag_x;
CW_left = e.screenY-drag_y;
}

</SCRIPT>
</HTML>
  • 打赏
  • 举报
回复
楼上的能解释一下吗?
clsid都出来了....好象在COM编程里看过
这段的意思是用BUTTON来代替上面那3个BUTTON?
还是说关闭该窗口的时候传递了一个NAME 为COMMAND,值不同的3个参数 ?
本人ROOKIE一个...希望能详细点说...谢谢
fangq 2005-08-15
  • 打赏
  • 举报
回复
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" value="Close"></OBJECT>

<input type=button value=最小化 onclick=hh1.Click()>
<input type=button value=最大化 onclick=hh2.Click()>
<input type=button value=关闭 onclick=hh3.Click()>
  • 打赏
  • 举报
回复
那改问如果用户关闭窗口,能触发其他任何事件让我处理有关这个用户的信息吗?
楼上一点钻研精神都没有...未必没有...只是微软不说而已...
看您2颗星,应该有其他方法来解决这样的问题吧?
线程?

游览器和HTML是不是一回事我真不知道...那这里也没有游览器专区给我啊....
若白师妹 2005-08-15
  • 打赏
  • 举报
回复
大家都说没有那就没有了
onclick? 浏览器本身和html事件是一回事吗?

28,391

社区成员

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

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