Javascript| tips//Refresh the unchanged text box<HTML>
<HEAD>
<meta name= "Save" content= "History" >
<STYLE>
. shistory {Behavior:url (#default #savehistory);}
</STYLE>
</HEAD>
<BODY>
<input class=shistory Type=text id=opersistinput>
</BODY>
</HTML>
//Access to the Clipboard (1) Drag and drop access
Event.dataTransfer.setData ("URL", OIMAGE.SRC);
Simageurl = Event.dataTransfer.getData ("URL")
(2) Ordinary visit
Window.clipboardData.setData ("Text", Osource.innertext);
Window.clipboardData.getData ("Text");
//Action Cookies
function Setcookie (sname, svalue)
{
Document.cookie = sname + "=" + Escape (svalue) + ";";
}
function GetCookie (sname)
{
var acookie = Document.cookie.split (";");
for (Var i=0 i < acookie.length; i++)
{
var acrumb = acookie[i].split ("=");
if (sname = = Acrumb[0])
Return unescape (acrumb[1]);
}
}
function Delcookie (sname)
{
Document.cookie = sname + "=" + Escape (svalue) + "; Expires=fri, Dec 1999 23:59:59 GMT; ";
}
//settimeout Add Parameters
<script>
var _st = window.settimeout;
Window.settimeout = function (Fref, mdelay) {
if (typeof fref = = ' function ') {
var Argu = Array.prototype.slice.call (arguments,2);
var f = (function () {fref.apply (null, ARGU);});
Return _st (f, mdelay);
}
Return _st (Fref,mdelay);
}
function test (x) {
alert (x);
}
Window.settimeout (test,1000, ' Fason ');
</script>
//Custom Apply,call
Function.prototype.apply = function (obj, Argu) {
if (obj) Obj.constructor.prototype._caller = this;
var argus = new Array ();
for (Var i=0;i<argu.length;i++)
Argus[i] = "argu[" + i + "]";
var R;
Eval ("R =" + (obj?) ("Obj._caller (" + Argus.join (",") + ");": ("This (" + Argus.join (",") + ");"));
return R;
};
Function.prototype.call = function (obj) {
var Argu = new Array ();
for (Var i=1;i<arguments.length;i++)
ARGU[I-1] = arguments[i];
return this.apply (obj, Argu);
}; Download files
function Downurl (Strremoteurl,strlocalurl)
{
Try
{
var xmlhttp=new activexobject ("Microsoft.XMLHTTP");
Xmlhttp.open ("Get", strremoteurl,false);
Xmlhttp.send ();
var adodbstream=new activexobject ("ADODB"). Stream ");
Adodbstream.type=1;//1=adtypebinary
Adodbstream.open ();
Adodbstream.write (Xmlhttp.responsebody);
Adodbstream.savetofile (strlocalurl,2);
Adodbstream.close ();
Adodbstream=null;
Xmlhttp=null;
}
catch (E)
{
Window.confirm ("Download URL error!");
}
Window.confirm ("Download complete.");
}
//Verify connection is valid function getxml (URL)
{
var Xmlhttp = new activexobject ("Microsoft.XMLHTTP");
xmlhttp. Open ("Get", Url, false);
try
{
xmlhttp. Send ();
}
catch (e) {}
finally
{
var result = Xmlhttp.responsetext;
if (Result)
{
if (XMLHTTP. status==200)
{
return (true);
}
else
{
return (false);
}
}
else
{
return (false);
}
}
}