当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 网页制作中常用的Javascript代码

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

网页制作中常用的Javascript代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 400 ::
收藏到网摘: n/a

本文介绍了一些网页制作中常用的Javascript代码,应该是比较常用的了,值得大家收藏。

  事件源对象

  以下是引用片段:

  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");

  根据鼠标获得元素:

  以下是引用片段:

  document.elementFromPoint(event.x,event.y).tagName=="TD

  document.elementFromPoint(event.x,event.y).appendChild(ms)

  窗体图片

  以下是引用片段:

  document.images[索引]

  

  窗体事件绑定

  以下是引用片段:

  document.onmousedown=scrollwindow;

  元素

  以下是引用片段:

  document.窗体.elements[索引]

  对象绑定事件

  以下是引用片段:

  document.all.xxx.detachEvent('onclick',a);

  插件数目

  以下是引用片段:

  navigator.plugins

  取变量类型

  以下是引用片段:

  typeof(js_libpath) == "undefined"

  

  下拉框

  以下是引用片段:

  下拉框.options[索引]

  下拉框.options.length

  查找对象

  以下是引用片段:

  document.getElementsByName("r1");

  document.getElementById(id);

  定时

  以下是引用片段:

  timer=setInterval('scrollwindow()',delay);

  clearInterval(timer);

  上一网页源

  以下是引用片段:

  asp:

  request.servervariables("HTTP_REFERER")

  javascript:

  document.referrer

  释放内存

  以下是引用片段:

  CollectGarbage();

  禁止右键

  以下是引用片段:

  document.oncontextmenu = function() { return false;}

  禁止保存

  以下是引用片段:

  <noscript><iframe src="*.htm"></iframe></noscript>

  禁止选取

  以下是引用片段:

  <body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()>

  禁止粘贴

  以下是引用片段:

  <input type=text onpaste="return false">

  地址栏图标

  以下是引用片段:

  <link rel="Shortcut Icon" href="favicon.ico">

  favicon.ico 名字最好不变16*16的16色,放虚拟目录根目录下

  收藏栏图标

  以下是引用片段:

  <link rel="Bookmark" href="favicon.ico">

  查看源码

  

  以下是引用片段:

  <input type=button value=查看网页源代码 onclick="window.location = 'view-source:' 'http://www.ruanchen.com/">

  关闭输入法

  以下是引用片段:

  <input style="ime-mode:disabled">

  自动全选

  以下是引用片段:

  <input type=text name=text1 value="123" onfocus="this.select()">