frank oo java

我爱oo,我爱java。http://oofrank.blogchina.com

My Links

Blog统计

公告

欢迎到 oofrank@blogchina 来 QQ:421057986 email:oofrank@163.com
www.flickr.com
oofrank@flickr with my S9500

Free Download Manager
Free Download Manager

文章

收藏

相册

IT

other

存档


正在读取评论……
添加到收藏夹:
<html>
<head>
<title>bookmark</title>
<script type="text/javascript">
//<![CDATA[
function bookmark(anchor){
if(window.external)
{
window.external.AddFavorite(anchor.getAttribute('href'), anchor.getAttribute('title'));
return false;
}
return true;
}
//]]>
</script>
</head>
<body>

<a href="http://www.google.com/" rel="sidebar" title="Google" onclick="return bookmark(this)">Bookmark</a>

</body>
</html>

在 <a> 中设置rel属性为 sidebar 可以在firefox中实现添加到收藏夹的功能,其中title属性值是默认书签名,href是书签地址(内容)。
============================================================
============================================================
事件处理:

<script>
if(window.addEventListener)
{
    FixPrototypeForGecko();
}
function FixPrototypeForGecko()
{
    HTMLElement.prototype.__defineGetter__("runtimeStyle",element_prototype_get_runtimeStyle);
    window.constructor.prototype.__defineGetter__("event",window_prototype_get_event);
    Event.prototype.__defineGetter__("srcElement",event_prototype_get_srcElement);
}
function element_prototype_get_runtimeStyle()
{
    //return style instead...
    return this.style;
}
function window_prototype_get_event()
{
    return SearchEvent();
}
function event_prototype_get_srcElement()
{
    return this.target;
}

function SearchEvent()
{
    //IE
    if(document.all)
        return window.event;
       
    func=SearchEvent.caller;
    while(func!=null)
    {
        var arg0=func.arguments[0];
        if(arg0)
        {
            if(arg0.constructor==Event)
                return arg0;
        }
        func=func.caller;
    }
    return null;
}

</script>

<button onclick="alert(event.clientX)">OK</button>

将以上代码copy到你的页面中,则可以在firefox的js函数中直接使用event来引用事件对象.




Trackback: http://tb.donews.net/TrackBack.aspx?PostId=318440


[点击此处收藏本文]  发表于2005年03月31日 10:38 AM




正在读取评论……
大名
网址
验证码
评论