|
1、一个连接 <a href="#" >连接</a>
当运行 run() 时 浏览器会自动回到页面头部,解决办法把 "#"了,换成
"javascript:void(0)"
2、点击按钮复制相关内容复制到内存,支持多浏览器
<html>
<body>
<script type="text/javascript">
// <![CDATA[
function copy_clip(copy){
if (window.clipboardData){
window.clipboardData.setData("Text", copy);}
else if (window.netscape){
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
if (!clip) return;
var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;
trans.addDataFlavor('text/unicode');
var str = new Object();
var len = new Object();
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
var copytext=copy;
str.data=copytext;
trans.setTransferData("text/unicode",str,copytext.length*2);
var clipid=Components.interfaces.nsIClipboard;
if (!clip) return false;
clip.setData(trans,null,clipid.kGlobalClipboard);}
alert("已复制"+copy)
return false;
}
// ]]>
</script>
<h1>请另存代码测试</h1>
<input type="text" id="ff" value="www.itwis.com" /><button >复制
</button>
</body>
</html>
3、页面跳转:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>妈妈网</title>
<meta http-equiv="Refresh" content="0;URL=http://baby.mama.cn/yahoo/index.html" />
</head>
<body>
</body>
</html> |
|