1. 论坛系统升级为Xenforo,欢迎大家测试!
    Dismiss Notice

JavaScript小技巧!!!!

Discussion in '前端开发' started by blackearth, Nov 11, 2006.

  1. blackearth

    blackearth New Member

    Joined:
    Sep 13, 2006
    Messages:
    154
    Likes Received:
    0
    事件源对象
    event.srcElement.tagName
    event.srcElement.type
    捕获释放
    event.srcElement.setCapture();
    event.srcElement.releaseCapture();
    事件按键
    event.keyCode
    event.shiftKey
    event.altKey
    event.ctrlKey
    事件返回值
    event.returnValue
    鼠标位置
    event.x
    event.y
    窗体活动元素
    document.activeElement
    绑定事件
    document.captureEvents(Event.KEYDOWN);
    访问窗体元素
    document.all("txt").focus();
    document.all("txt").select();
    窗体命令
    document.execCommand
    窗体COOKIE
    document.cookie
    菜单事件
    document.oncontextmenu
    创建元素
    document.createElement("SPAN");
    自动刷新
    <meta HTTP-EQUIV="refresh" C>
    简单邮件
    <a href="mailto:[email protected]?subject=ccc&body=xxxyyy">
    快速转到位置
    obj.scrollIntoView(true)

    <a name="first">
    <a href="#first">anchors</a>
    网页传递参数
    location.search();
    可编辑
    obj.contenteditable=true
    执行菜单命令
    obj.execCommand
    窗口最大化
    <body >
    无关闭按钮IE
    window.open("aa.htm", "meizz", "fullscreen=7");
    统一编码/解码
    alert(decodeURIComponent(encodeURIComponent("http://你好.com?as= hehe")))
    encodeURIComponent对":"、"/"、";" 和 "?"也编码