易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript小技巧

 IE7不经提示关闭浏览器窗口
<a href="javascript:window.open('','_top'); window.top.close();">Close IE7</a>
----------------------------
用window.open方法打开新窗口显示提示信息
有时候我们需要打开一个新窗口用来显示提示信息
这个自然会想到用window.open()方法
但新窗体的内容并不是固定的
如果我们建立一个 tip.html 的静态页面,专门用来让window.open打开,打开之后再用js设置窗体的内容
这样做也能满足要求,但是有没有更好的方法呢?
下面的方法可以不用建一个专门的静态页面,而是每次都是打开一个临时窗口,窗体的内容也是动态构造的
请看代码:
<input type=button value=open onclick="openWindow=window.open();
    openWindow.document.writeln('<html>');
    openWindow.document.writeln('<TITLE>Open Test</TITLE>');
    openWindow.document.writeln('<BODY>');
    openWindow.document.writeln('<center>');
    openWindow.document.writeln('Hello! New window opened!'); 
    openWindow.document.writeln('<br><br>');
    openWindow.document.writeln('<input type=button value=close onclick=window.close()>'); 
    openWindow.document.writeln('</center>');
    openWindow.document.writeln('</BODY>'); 
    openWindow.document.writeln('</HTML>'); 
    openWindow.document.close(); " >
==========================================
网页屏蔽鼠标右键和左键选中功能
document.oncontextmenu = new Function("event.returnValue=false;");
document.onselectstart = new Function("event.returnValue=false;");
=======================================================
用JavaScript获取客户端MAC地址(转)
 
<HTML><HEAD><TITLE>WMI Scripting HTML</TITLE>
<META http-equiv=Content-Type conte


相关文档:

JavaScript checkbox全选与全不选的切换

  function select_all(){
var paras = document.getElementsByTagName("input");//全选checkbox
if(document.getElementById("all").checked==true){
for(var i=0; i<paras.length; i++){
var name = paras[i].getAttribute("name") //单选checkbox的name均d ......

Javascript操作下拉框的常用方法

 function AddDropDownList(id,fatherCtl)
{
    if(!document.getElementById(id))
    {
        var ddl = document.createElement('select');
        ddl.s ......

Javascript常用的经典技巧

 
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut=" ......

操作ClassName的工具函数(JavaScript权威指南)

/**
* CSSClass.js
*/
var CSSClass = {}; //Create our namespace object
//Return tru if element e is a member of the class c;false otherwise
CSSClass.is = fucntion(e, c)
{
if(typeof e == "string")
e = document.getElementById(e);
//Before doing a regexp search,optimize for couple of co ......

javascript 字符串的乘法

 在ruby中我们可以通过"*"操作符去字符串进行倍增,如"ruby"*2则返回"rubyruby"。在javascript中,字符串只能用加号,嘛,乘法也加法演变过来的。我们可以搞一个试试。
方法一
  String.prototype.times = function(n) {//IE6 530-640 FF3 400~550 IE8 840 ~1110   chrome 600~1000
  &nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号