SoFunction
Updated on 2025-04-14

JavaScript tips  Super recommendation page 4/5


//Special effects of page entry and exit 

Enter the page <meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
Release page <meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)">
This is some special effects when the page is loaded and called out. duration represents the duration of the special effect in seconds. transition means to make
Which special effect to use, the value is 1-23:
0 Rectangle reduction
1 Rectangle enlargement
2. Circle reduction
3. Circular enlargement
4 Down to top refresh
5. Refresh up to down
6 Refresh left to right
7 Right to left refresh
8 vertical blinds
9 Horizontal blinds
10 Displaced horizontal blinds
11 Dislocated vertical blinds
12 points of diffusion
13. Refresh around the middle
14 Refresh in the middle to left and right
15 Middle to top
16 Up and down to middle
17 Downright to upper left
18 Upper right to lower left
19 Upper left to lower right
20 Down left to upper right
21 horizontal bar
22 vertical bar
23  
//Whether the web page is retrieved?

<meta name="ROBOTS" content="attribute value">
The attribute values ​​are as follows:
The attribute value is "all": The file will be retrieved, and the links on the page can be queried;
The attribute value is "none": The file is not retrieved, and the links on the page are not queryed;
The property value is "index": The file will be retrieved;
The attribute value is "follow": the link on the query page;
The attribute value is "noindex": The file is not retrieved, but can be queryed for links;
The attribute value is "nofollow":


//Print paging 

<p  style="page-break-after:always">page1</p>   
<p  style="page-break-after:always">page2</p>   


//Set print 


<object  style="display:none" viewastext 
  class 
  codebase="/scriptx/#Version=5,60,0,360" 
></object> 
<input type=button value=page setting onclick="()">
<input type=button value=print preview onclick="()">

<script language=javascript> 
function () 

   // -- advanced features 
   (2) // measure margins in inches 
   (false, 1, 3) // need pages from 1 to 3 
    = "HP DeskJet 870C" 
    = 2 
    = true 
    = "A4" 
    = "Manual feed" 
   // -- basic features 
= "Show left and b center and b right and display page numbers, page &p/total &p pages"
= "(custom footer)"
    = false 
    = 0.75 
    = 1.5 
    = 0.75 
    = 1.5 

function Print(frame) { 
  (true, frame) // print with prompt 

</script> 
<input type=button value="Print this page" onclick="(false)">
<input type=button value="page settings" onclick="()">
<input type=button value="Print Preview" onclick="()"><br>
<a href="/scriptx/docs/?static"  target=_blank>Specific user manual, for more information, click here</a>

//Introduced print preview 

(1,1) Open
(2,1) Close all IE windows now and open a new window
(4,1) Save the web page
(6,1) Print
(7,1) Print preview
(8,1) Print page settings
(10,1) View page properties
(15,1) It seems to be cancelled, and it is to be confirmed
(17,1) Select all
(22,1) Refresh
(45,1) Close the form without prompt
<style media=print>  
.Noprint{display:none;}<!--Hide non-print items when printing with this style-->
.PageNext{page-break-after: always;}<!--Control pagination-->
</style>  
<object    width=0  height=0  class>     
</object>     

<center class="Noprint" > 
<input type=button value=print onclick=(6,1)>
<input type=button value=print directly onclick=(6,6)>
<input type=button value=page setting onclick=(8,1)>
</p>  
<p> <input type=button value=print preview onclick=(7,1)>
</center> 
//Remove the header and footer when printing 


<script  language="JavaScript">   
var HKEY_Root,HKEY_Path,HKEY_Key; 
HKEY_Root="HKEY_CURRENT_USER"; 
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\"; 
//Set the header and footer of the web page printing to be empty
function PageSetup_Null() 

 try 
 { 
         var Wsh=new ActiveXObject(""); 
  HKEY_Key="header"; 
  (HKEY_Root+HKEY_Path+HKEY_Key,""); 
  HKEY_Key="footer"; 
  (HKEY_Root+HKEY_Path+HKEY_Key,""); 
 } 
 catch(e){} 

//Set the header and footer of web page printing as the default value
function  PageSetup_Default() 
{   
 try 
 { 
  var Wsh=new ActiveXObject(""); 
  HKEY_Key="header"; 
(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b page number,&p/&P");
  HKEY_Key="footer"; 
  (HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d"); 
 } 
 catch(e){} 

</script> 
<input type="button" value="Clear the page number" onclick=PageSetup_Null()>
<input type="button" value="recover page number" onclick=PageSetup_Default()>
//Browser Verification 


function checkBrowser() 
{  
   =  
   =?1:0  
   this.ie6=(("MSIE 6")>-1 && )?1:0;  
   this.ie5=(("MSIE 5")>-1 && )?1:0;  
   this.ie4=( && !)?1:0;  
   this.ns5=( && parseInt() >= 5) ?1:0;  
   this.ns4=( && !)?1:0;  
   =(('Mac') > -1) ?1:0;  
   =(('Opera')>-1);  
   =(this.ie6 || this.ie5 || this.ie4)  
   =(this.ns4 || this.ns5)  
   =(this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 ||  || )  
   =(!)  
   return this; 

//Calculate content width and height 

<SCRIPT  language="javascript">   
function  test(obj)   
{   
       var  range  =  ();   
alert("Content area width:"  +
+  "px\r\nContent area height: "  +   +"px");

}   
</SCRIPT>   
<BODY>   
<Textarea  height="150">sdf</textarea><INPUT  type="button"  value="calculate content width"  onClick="test(txt)">
</BODY> 
//Modeless prompt box 

function modelessAlert(Msg) 

   ("javascript:alert(\""+escape(Msg)+"\");();","","status:no;resizable:no;help:no;dialogHeight:height:30px;dialogHeight:40px;"); 





//Shield button 

<html> 
<head> 
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
  <noscript><meta http-equiv="refresh" content="0;url=about:noscript"></noscript> 
<title>Mask the right mouse button, Ctrl+N, Shift+F10, Alt+F4, F11, F5 refresh, backspace key</title>
</head> 
<body> 
<script language="Javascript"><!-- 
//Mask the right mouse button, Ctrl+N, Shift+F10, F11, F5 refresh, backspace key
//Author: meizz(Plum Blossom Rain) 2002-6-18
function (){=false;}//Block the right mouse button
function (){return false} //Block F1 help
function () 

  if (()&& 
((==37)||  //Shield Alt+ Arrow key ←
(==39)))   //Shield Alt+ Arrow keys →
  { 
alert("You are not allowed to use the ALT+ arrow keys to advance or back the web page!");
     =false; 
  } 
/* Note: This is not really blocking the Alt+ arrow keys,
Because when the Alt+ arrow key pops up the warning box, press and hold the Alt key and keep it on putting it.
Click the warning box with the mouse, and this blocking method will fail. If
Any expert has a way to truly block the Alt key, please let me know. */
if ((==8)  ||
(==116)||
      ( && ==82)){ //Ctrl + R 
     =0; 
     =false; 
     } 
if (==122){=0;=false;}  //Mask F11
if ( && ==78) =false;   //Block Ctrl+n
if ( && ==121)=false;  //Shield shift+F10
  if ( == "A" && )  
= false;                   //Shield shift add the left mouse button to open a new web page
if (()&&(==115))
  { 
      ("about:blank","","dialogWidth:1px;dialogheight:1px"); 
      return false; 
  } 

</script> 
Block the right mouse button, Ctrl+N, Shift+F10, Alt+F4, F11, F5 refresh, backspace key
</body> 
</html> 
//Shield printing
<style> 
@media print{ 
* {display:none} 

</style> 

//Move the layer, drag


1.<span style='position:absolute;width:200;height:200;background:red' onmousedown=MouseDown(this) onmousemove=MouseMove() onmouseup=MouseUp()>meizz</span> 
<script language=javascript> 
var Obj; 
function MouseDown(obj) 

  Obj=obj; 
  (); 
  =; 
  =; 

function MouseMove() 

  if(Obj!=null) 
  { 
     = ; 
     = ; 
  } 

function MouseUp() 

  if(Obj!=null) 
  { 
    (); 
    Obj=null; 
  } 

</script> 
2. 
<div  src="" ondrag="doDrag();" onmouseover="='hand'" style="position:absolute;left=100;top=100;" onmousedown="doMouseDown();"> 
<a href="#" onclick="return false"><h1>wlecome</h1></a> 
</div> 
<script language="JavaScript" type="text/javascript"> 
var orgMouseX; 
var orgMouseY; 
var orgObjX; 
var orgObjY; 
function doDrag() 

var myObject=; 

var x=; 
var y=; 
=x-(orgMouseX-orgObjX); 
=y-(orgMouseY-orgObjY); 


function doMouseDown() 

orgMouseX=; 
orgMouseY=; 
orgObjX=parseInt(); 
orgObjY=parseInt(); 


</script> 

//The document status changes


<iframe src=""  name="f" scrolling="no" frameborder=0 marginwidth=0 marginheight=0></iframe> 
<script> 
var doc=["f"].document; 
function s(){ 
 if (=="complete"){ 
  = 
  = 
 } 

=s 
</script> 

//The text box that remains unchanged after refresh

<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 the clipboard

(1) Drag and drop access
("URL", ); 
sImageURL = ("URL") 
(2) Ordinary visit
("Text",); 
("Text"); 

//Operate COOKIE


function SetCookie(sName, sValue) 

  = sName + "=" + escape(sValue) + "; "; 

function GetCookie(sName) 

 var aCookie = ("; "); 
 for (var i=0; i < ; i++) 
 { 

  var aCrumb = aCookie[i].split("="); 
  if (sName == aCrumb[0])  
  return unescape(aCrumb[1]); 
 } 


function DelCookie(sName) 

 = sName + "=" + escape(sValue) + "; expires=Fri, 31 Dec 1999 23:59:59 GMT;"; 

//setTimeout adds parameters

<script> 
var _st = ; 
 = function(fRef, mDelay) { 
 if(typeof fRef == 'function'){ 
  var argu = (arguments,2); 
  var f = (function(){ (null, argu); }); 
  return _st(f, mDelay); 
 } 
 return _st(fRef,mDelay); 

function test(x){ 
 alert(x); 

(test,1000,'fason'); 
</script> 

//Custom apply, call

 = function (obj, argu) { 
 if (obj) ._caller = this;  
 var argus = new Array(); 
 for (var i=0;i<;i++) 
  argus[i] = "argu[" + i + "]"; 
 var r; 
 eval("r = " + (obj ? ("obj._caller(" + (",") + ");") : ("this(" + (",") + ");"))); 
 return r; 
}; 
 = function (obj) { 
 var argu = new Array(); 
 for (var i=1;i<;i++) 
  argu[i-1] = arguments[i]; 
 return (obj, argu); 
};        

//Download the file

function DownURL(strRemoteURL,strLocalURL) 

 try 
 { 
  var xmlHTTP=new ActiveXObject(""); 
  ("Get",strRemoteURL,false); 
  (); 
  var adodbStream=new ActiveXObject(""); 
  =1;//1=adTypeBinary 
  (); 
  (); 
  (strLocalURL,2); 
  (); 
  adodbStream=null; 
  xmlHTTP=null; 

 } 
 catch(e) 
 { 
("Error downloading URL!");
 } 
//("Download completed.");


//Check whether the connection is valid

function getXML(URL)  

 var xmlhttp = new ActiveXObject(""); 
 ("GET",URL, false);  
 try 
 {  
  (); 
 } 
 catch(e){} 
 finally  
 { 
  var result = ; 
  if(result)  
  { 
   if(==200) 
   { 
    return(true); 
   } 
   else  
   { 
    return(false); 
   } 
  } 
  else  
  { 
   return(false); 
  } 
 } 

//POST replaces FORM

<SCRIPT language="VBScript"> 
Function URLEncoding(vstrIn) 
    strReturn = "" 
    For i = 1 To Len(vstrIn) 
        ThisChr = Mid(vStrIn,i,1) 
        If Abs(Asc(ThisChr)) < &HFF Then 
            strReturn = strReturn & ThisChr 
        Else 
            innerCode = Asc(ThisChr) 
            If innerCode < 0 Then 
                innerCode = innerCode + &H10000 
            End If 
            Hight8 = (innerCode  And &HFF00)\ &HFF 
            Low8 = innerCode And &HFF 
            strReturn = strReturn & "%" & Hex(Hight8) &  "%" & Hex(Low8) 
        End If 
    Next 
    URLEncoding = strReturn 
End Function 
Function bytes2BSTR(vIn) 
    strReturn = "" 
    For i = 1 To LenB(vIn) 
        ThisCharCode = AscB(MidB(vIn,i,1)) 
        If ThisCharCode < &H80 Then 
            strReturn = strReturn & Chr(ThisCharCode) 
        Else 
            NextCharCode = AscB(MidB(vIn,i+1,1)) 
            strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) 
            i = i + 1 
        End If 
    Next 
    bytes2BSTR = strReturn 
End Function 
dim strA,oReq 
strA= URLEncoding("submit1=Submit&text1=Chinese")
set oReq = CreateObject("") 
 "POST","http://ServerName/VDir/",false 
 "Content-Length",Len(strA) 
 "CONTENT-TYPE","application/x-www-form-urlencoded" 
 strA 
msgbox bytes2BSTR() 
</SCRIPT> 
//readyState is the progress of the data returned by xmlhttp, 0=Loading, 1=Uninitialized, 2=Loading, 3=Running, 4=Completed



//Whether the component is installed
isComponentInstalled("{6B053A4B-A7EC-4D3D-4567-B8FF8A1A5739}", "componentID")) 

//Check whether the web page exists


function CheckURL(URL) 

  var xmlhttp = new ActiveXObject(""); 
  ("GET",URL, false); 
  try 
  {  
    ();  
    var result = ; 
  } 
  catch(e) {return(false); } 
  if(result==200) 
  {  
    return true; 
  } 
  xmlhttp = null; 
  return false; 

//Connect the database


<script language="javascript"> 
//Example of using JavaScript to write a server-side connection to the database
  var conn = new ActiveXObject(""); 
  ("Provider=SQLOLEDB.1; Data Source=localhost; User ID=sa; " 
    +"Password=; Initial Catalog=pubs"); 
  var rs = new ActiveXObject(""); 
  var sql="select * from authors"; 
  (sql, conn); 
 shtml = "<table width='100%' border=1>"; 
 shtml +="<tr bgcolor='#f4f4f4'><td>au_id</td><td>au_lname</td><td>au_fname</td><td>phone</td><td>address</td><td> city</td><td>state</td><td>zip</td></tr>"; 
  while(!) 
  { 
 shtml += "<tr><td>" + rs("au_id") + "</td><td>" + rs("au_lname") + "</td><td>" + rs("au_fname") + "</td><td>" + rs("phone") + "</td><td>" + rs("address") + "</td><td>" + rs("city") + "</td><td>" + rs("state") + "</td><td>" + rs("zip") + "</td></tr>"; 
 ; 
  } 
  shtml += "</table>"; 
  (shtml); 
  ();  
  rs = null;  
  ();  
  conn = null; 
</script> 
//Use the data island


<html> 
<body> 
srno:<input type=text datasrc=#xmldate DataFLD=srno size="76"><BR> 
times:<input type=text datasrc=#xmldate DataFLD=times size="76"><BR> 
<input  TYPE=button value="<< First record" onclick="()">
<input  TYPE=button value="<Previous record" onclick="()">
<input  TYPE=button value="Next record>" onclick="()">
<input  TYPE=button value="last record>>" onclick="()">
<input  TYPE=button value="Add a new record" onclick="()">

<XML ID="xmldate"> 
<infolist> 
<info ><srno>20041025-01</srno><times>null</times></info> 
<info ><srno>20041101-09</srno><times>October 1, 2004 2:22:00</times></info>
</infolist> 
</XML> 
</body> 
</html> 
//Get parameters

<body> 
<a href="javascript:= + '?a=1&b=2'">search</a> 
<script language="JavaScript"> 
<!-- 
var a = (1); 
if(>0) 

 var re = /([^&]*?)\=([^&]*)/g 
 var s = (re); 
 for(var i= 0;i<;i++) 
 { 
  alert(s[i]); 
  alert(s[i].split("=")[1]); 
 } 

//--> 
</script> 
</body> 
//Editable SELECT

<input type=text name=re_name style="width:100px;height:21px;font-size:10pt;"><span style="width:18px;border:0px solid red;"><select name="r00" style="margin-left:-100px;width:118px; background-color:#FFEEEE;" onChange=".re_name.value=;"> 
                <option value="1">11111111<option> 
                <option value="2">222222</option> 
                <option value="3">333333</option> 
              </select> 
              </span> 



//Set the cursor position


function getCaret(textbox) 

 var control = ; 
 (); 
 var rang = (); 
  ("StartToStart",()) 
 (); 
 return ; 

function setCaret(textbox,pos) 

 try 
 { 
  var r =(); 
   ('character',pos); 
   (true); 
   (); 
 } 
 catch(e) 
 {} 

function selectLength(textbox,start,len) 

 try 
 { 
  var r =(); 

  ('character',len-(-start)); 
  ('character',start); 

  (); 
 } 
 catch(e) 
 {//alert()} 

function insertAtCaret(textbox,text) 

 (); 
 ().text = text; 


// Search within the page


function findInPage(str) 

 var txt, i, found,n = 0; 
 if (str == "") 
 { 
  return false; 
 } 
 txt = (); 
 for (i = 0; i <= n && (found = (str)) != false; i++) 
 { 
  ("character", 1); 
  ("textedit"); 
 } 
 if (found) 
 { 
  ("character", -1); 
  (str); 
  (); 
  (); 
  n++;   
 } 
 else 
 { 
  if (n > 0) 
  { 
   n = 0; 
   findInPage(str); 
  } 
  else 
  { 
alert(str + "...                                                                                                                          �
  } 
 } 
 return false; 

//Book

/?s=&postid=1894598 
/down/?id=1341 
//Operate EXECL

<script language="javascript"> 
function jStartExcel() { 
 var xls = new ActiveXObject ( "" ); 
  = true; 
 var newBook = ; 
 ; 
 (1).Activate; 
  = 2; 
  = 5; 
 (1).Columns("A").columnwidth=50; 
 (1).Columns("A").WrapText = true; 
 (1).Columns("B").columnwidth=50; 
 (1).Columns("B").WrapText = true; 
 (1).Range("A1:B1000").NumberFormat = "0"; 
 (1).Range("A1:B1000").HorizontalAlignment = -4131; 
 (1).Cells(1,1).="15"; 
 (1).Cells(1,1).value="First Column, First Cell"; 
 (1).Cells(2,1).value="First Column, Second Cell"; 
 (1).Cells(1,2).value="Second Column, First Cell"; 
 (1).Cells(2,2).value="Second Column, Second Cell"; 
 (1).Name="My First WorkSheet"; 

</script> 

//Custom prompt bar


<a href="#" title="This is a prompt">tip</a>
<script Language="JavaScript"> 
//*************** Default setting definition.************************
tPop Wait=50;//Stay Wait milliseconds and displays a prompt.
topShow=5000;//The prompt is closed after displaying Show milliseconds.
showPopStep=20; 
popOpacity=99; 
//*************** Internal variable definition************************
sPop=null; 
curShow=null; 
tFadeOut=null; 
tFadeIn=null; 
tFadeWaiting=null; 
("<style type='text/css'id='defaultPopStyle'>"); 
(".cPopText {  background-color: #F8F8F5;color:#000000; border: 1px #000000 solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}"); 
("</style>"); 
("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>"); 

function showPopupText(){ 
var o=; 
MouseX=; 
MouseY=; 
if(!=null && !=""){=;=""}; 
        if(!=null && !=""){=;=""}; 
if(!=sPop) { 
sPop=; 
clearTimeout(curShow); 
clearTimeout(tFadeOut); 
clearTimeout(tFadeIn); 
clearTimeout(tFadeWaiting); 
if(sPop==null || sPop=="") { 
=""; 
="Alpha()"; 
=0; 

else { 
if(!=null) popStyle=  
else popStyle="cPopText"; 
curShow=setTimeout("showIt()",tPopWait); 



function showIt(){ 
=popStyle; 
=sPop; 
popWidth=; 
popHeight=; 
if(MouseX+12+popWidth>) popLeftAdjust=-popWidth-24 
else popLeftAdjust=0; 
if(MouseY+12+popHeight>) popTopAdjust=-popHeight-24 
else popTopAdjust=0; 
=MouseX+12++popLeftAdjust; 
=MouseY+12++popTopAdjust; 
="Alpha(Opacity=0)"; 
fadeOut(); 

function fadeOut(){ 
if(<popOpacity) { 
+=showPopStep; 
tFadeOut=setTimeout("fadeOut()",1); 

else { 
=popOpacity; 
tFadeWaiting=setTimeout("fadeIn()",tPopShow); 


function fadeIn(){ 
if(>0) { 
-=1; 
tFadeIn=setTimeout("fadeIn()",1); 


=showPopupText; 
</script> 
//Insert text

 =function(){  
var oSource = ;  
if(!="DIV")  
return false;  
var sel = ;  
if (sel!=null) {  
var rng = ();  
if (rng!=null)  
("<font color=red>Insert text</font>");
}  
}  
//Operate xml under netscapte

doc = new ActiveXObject(""); 
doc = new ActiveXObject("") 
->> 
doc = (new DOMParser()).parseFromString(sXML,'text/xml') 

//Judge key value

<html> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<head> 
<script language="javascript"> 
var ie  ==="Microsoft Internet Explorer"?true:false; 

function keyDown(e) 

 if(!ie) 
 { 
  var nkey=; 
var iekey='Ns browser now';
  var realkey=(); 
 } 
 if(ie) 
 { 
  var iekey=; 
var nkey='It's now an ie browser';
  var realkey=(); 
if(==32){realkey='\' space\''}
if(==13){realkey='\' Enter\''}
  if(==27){realkey='\' Esc\''} 
  if(==16){realkey='\' Shift\''} 
  if(==17){realkey='\' Ctrl\''} 
  if(==18){realkey='\' Alt\''} 
 } 
alert('ns browser key value:'+nkey+'\n'+'ie key value:'+iekey+'\n'+' actual key is '+realkey);

 = keyDown; 
</script> 
</head> 
<body> 
//Javascript Document. 
<hr> 
<center> 
<h3>Please press any key. . . . </h3>
</center> 
</body> 
</html> 

//FSO is prohibited


1. Log out of component
regsvr32 /u  
2. Modify PROGID
HKEY_CLASSES_ROOT\ 
 
3. For users who use object, modify HKEY_CLASSES_ROOT\Scripting.

//Electronic

<DIV STYLE="width: 120px; height: 50px; border: 1px solid blue; 
            overflow: hidden; text-overflow:ellipsis"> 
<NOBR>For example, there is a line of text that is very long and cannot be displayed in a row in the table.</NOBR>
</DIV> 

//Detection of media play version


<IE:clientCaps ID="oClientCaps" style="{behavior:url(#default#clientcaps)}" /> 
<SCRIPT> 
var flash=""; 
    WMPVersion= ("{22D6F312-B0F6-11D0-94AB-0080C74C7E95}","ComponentID");  
    if (WMPVersion != "") { 
    flash = ""; 
    var version = (","); 
    var i; 
    for (i = 0; i < ; i++) { 
      if (i != 0) 
    flash += "."; 
      flash += version[i]; 
    } 
("Your Windows Media Player version is: "+flash+"<p>");
  } 
</SCRIPT> 




//The image is proportional


<script language="JavaScript"> 
<!-- 
//The picture is scaled to scale
var flag=false; 
function DrawImage(ImgD){ 
 var image=new Image(); 
var iwidth = 80;  //Define the allowed image width
var iheight = 80;  //Define the allowed image height
 =; 
 if(>0 && >0){ 
 flag=true; 
 if(/>= iwidth/iheight){ 
  if(>iwidth){   
  =iwidth; 
  =(*iwidth)/; 
  }else{ 
  =;   
  =; 
  } 
  =+"×"+; 
  } 
 else{ 
  if(>iheight){   
  =iheight; 
  =(*iheight)/;   
  }else{ 
  =;   
  =; 
  } 
  =+"×"+; 
  } 
 } 
}  
//--> 
</script> 
<img src=".." onload = "DrawImage(this)"> 




//Thin line SELECT


<span style="border:1px solid #000000; position:absolute; overflow:hidden;" > 
<select style="margin:-2px;"> 
<option>1111</option> 
<option>11111111111111</option> 
<option>111111111</option> 
</select></span> 

//Import 


function Import() { 
 for( var i=0; i<; i++ ) { 
  var file = arguments[i]; 
  if ( (/\.js$/i))  
   ('<script type=\"text/javascript\" src=\"' + file + '\"></sc' + 'ript>'); 
  else 
   ('<style type=\"text/css\">@import \"' + file + '\" ;</style>'); 
 } 
}; 

//js enumeration


function getComputerName() 

 var objWMIService = GetObject("Winmgmts:root\cimv2"); 
 for(e = new Enumerator(objWMIService) ; !() ; ()) 
 { 
    var getComputer = (); 
    return ; 
 } 



//Conditional Compilation


<script language=javascript> 
/*@cc_on @*/ 
/*@if (@_win32 && @_jscript_version>5) 
function (str) 

    execScript("n = msgbox('"+ str +"', 257)", "vbscript"); 
    return(n == 1); 

@end @*/ 
</script> 


//Get innerText



<SCRIPT LANGUAGE="JavaScript"> 
<!-- 
 var xmlDoc = new ActiveXObject(".4.0"); 
 var currNode; 
  = false; 
  = false; 
("<TABLENAME>        Hello, you A San                                                                                                               �
 currNode = ; 

  var s = ; 
  var r = /\<([^\>\s]*?)[^\>]*?\>([^\<]*?)\<\/\1\>/ 
  var b = (r,"$2"); 
  alert(b); 
//--> 
</SCRIPT> 
//mergeAttributes Copy all read/write tag attributes to the specified element.

<SCRIPT> 
function fnMerge(){ 
[1].mergeAttributes([0]); 

</SCRIPT> 
<SPAN ID=oSource> 
<DIV 
ID="oDiv" 
ATTRIBUTE1="true" 
ATTRIBUTE2="true" 
onclick="alert('click');" 
onmouseover="='#0000FF';" 
onmouseout="='#000000';" 

This is a sample <B>DIV</B> element. 
</DIV> 
<DIV ID="oDiv2"> 
This is another sample <B>DIV</B> element. 
</DIV> 
</SPAN> 
<INPUT 
TYPE="button" 
VALUE="Merge Attributes" 
onclick="fnMerge()" 

Previous page12345Next pageRead the full text