#sx{color:#00c;text-decoration:underline;cursor:pointer;}
手写
var w = window,d = document,n = navigator,k = d.f.wd
if (w.attachevent) {
w.attachevent("onload", function() {k.focus();})
} else {
w.addeventlistener('load', function() {k.focus()},true)
};
var hw = {};
hw.i = d.getelementbyid("sx");
var il = false;
if (/msie (\d+\.\d)/i.test(n.useragent)) {
hw.i.setattribute("unselectable", "on")
} else {
var sl = k.value.length;
k.selectionstart = sl;
k.selectionend = sl
}
hw.i.onclick = function(b) {
var b = b || w.event;
b.stoppropagation ? b.stoppropagation() : (b.cancelbubble = true);
if (d.selection && d.activeelement.id && d.activeelement.id == "kw") {
hw.hasf = 1
} else {
if (!d.selection) {
hw.hasf = 1
}
}
if (!il) {
var a = d.createelement("script");
a.setattribute("src", "http://www.baidu.com/hw/hwinput.js");
d.getelementsbytagname("head")[0].appendchild(a);
il = true;
}
};
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]