//设置光标位置
function getCaret(textbox)
{
var control = document.activeElement;
textbox.focus();
var rang = document.selection.createRange();
rang.setEndPoint("StartToStart",textbox.createTextRange())
control.focus();
return rang.text.length;
}
function setCaret(textbox,pos)
{
try
{
var r =textbox.createTextRange();
r.moveStart('character',pos);
r.collapse(true);
r.select();
}
catch(e)
{}
}
function selectLength(textbox,start,len)
{
try
{
var r =textbox.createTextRange();
r.moveEnd('character',len-(textbox.value.length-start));
r.moveStart('character',start);
r.select();
}
catch(e)
{//alert(e.description)}
}
function insertAtCaret(textbox,text)
{
textbox.focus();
document.selection.createRange().text = text;
}
//页内查找
function findInPage(str)
{
var txt, i, found,n = 0;
if (str == "")
{
return false;
}
txt = document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++)
{
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
if (found)
{
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else
{
if (n > 0)
{
n = 0;
findInPage(str);
}
else
{
alert(str + "… 您要找的文字不存在。"n "n请试着输入页面中的关键字再次查找!");
}
}
return false;
}
//操作EXECL
//自定义提示条
//插入文字
document.onclick =function(){
var oSource = window.event.srcElement;
if(oSource.tagName!="DIV")
return false;
var sel = document.selection;
if (sel!=null) {
var rng = sel.createRange();
if (rng!=null)
rng.pasteHTML("插入文字");
}
}
//netscapte下操作xml
doc = new ActiveXObject("Msxml2.DOMDocument");
doc = new ActiveXObject("Microsoft.XMLDOM")
->>
doc = (new DOMParser()).parseFromString(sXML,'text/xml')
//禁止FSO
1.注销组件
regsvr32 /u scrrun.dll
2.修改PROGID
HKEY_CLASSES_ROOT"Scripting.FileSystemObject
Scripting.FileSystemObject
3.对于使用object的用户,修改HKEY_CLASSES_ROOT"Scripting.
//省略号
//判断键值
//检测media play版本
//图象按比例
//细线SELECT
//Import
function Import() {
for( var i=0; i
else
document.write('');
}
};
//js枚举
function getComputerName()
{
var objWMIService = GetObject("Winmgmts:root"cimv2");
for(e = new Enumerator(objWMIService) ; !e.atEnd() ; e.moveNext())
{
var getComputer = e.item();
return getComputer.Name;
}
}
//条件编译
//取得innerText
//mergeAttributes 复制所有读/写标签属性到指定元素。
<INPUT
TYPE="button"
VALUE="Merge Attributes"
onclick="fnMerge()"
>出处至:http://xiaobingandxiaoer.iteye.com/blog/1917696出处至:http://xiaobingandxiaoer.iteye.com/blog/1917696 出处至:http://xiaobingandxiaoer.iteye.com/blog/1917696
出处至:http://xiaobingandxiaoer.iteye.com/blog/1917696出处至:http://xiaobingandxiaoer.iteye.com/blog/1917696
出处至:http://xiaobingandxiaoer.iteye.com/blog/1917696出处至:http://xiaobingandxiaoer.iteye.com/blog/1917696
手机扫一扫
移动阅读更方便
你可能感兴趣的文章