Convert-common JS Code such as "add to favorites, print, and save as" (in the form of Button input and link)

Source: Internet
Author: User

Script description:

  • Take the followingCodeAdd to the <body> area:
  • Move backward
  • <Input type = "button" value = "back" onclick = "history. Go (-1)">
  • <Input type = "button" value = "Forward" onclick = "history. Go (1); Return true;">
  • Return
  • <Form> <input type = "button" value = "back to previous step" onclick = "history. Back (-1)"> </form>
  • View Source Code
  • <Input type = "button" name = "View" value = "view source code" onclick = "window. Location =" view-source: "+ window. Location. href">
  • Prohibit source code viewing
  • <Body oncontextmenu = "Return false"> </body>
  • Refresh button 1
  • <Input type = "button" value = "Refresh button 1" onclick = "reloadbutton ()">
  • <SCRIPT> function reloadbutton () {location. href = "i001.htm" ;}</SCRIPT>
  • Refresh button 2
  • <Input type = "button" value = "Refresh button 2" onclick = "history. Go (0)">
  • Home page button
  • <Input type = "button" value = "Homepage" onclick = "homebutton ()">
  • <SCRIPT> function homebutton () {location. href = http://www.winliuxq.com/;} </SCRIPT>
  • Pop-up warning box
  • <Input type = "button" value = "pop-up warning box" onclick = "alertbutton ()">
  • <SCRIPT> function alertbutton () {window. Alert ("coming soon! ") ;}</SCRIPT>
  • Status Bar Information
  • <Input type = "button" value = "status bar information" onclick = "statusbutton ()">
  • <SCRIPT> function statusbutton () {window. Status = "coming soon! ";}</SCRIPT>
  • Background Color Conversion
  • <Form> <input type = "button" value = "background color conversion" onclick = "bgbutton ()"> </form>
  • <SCRIPT> function bgbutton (){
  • If (document. bgcolor = '# 00ffff ')
  • {Document. bgcolor = '# ffff ';}
  • Else {document. bgcolor = '# 00ffff ';}
  • }
  • </SCRIPT>
  • Open new window
  • <Input type = "button" value = "open a new window" onclick = "newwindow ()">
  • <SCRIPT> function newwindow () {window. open ("c01.htm", "", "Height = 240, width = 340, status = No, location = No, toolbar = No, directories = No, menubar = No ");}
  • </SCRIPT>
  • Minimize windows
  • <Object ID = "min" type = "application/X-oleobject" classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11 "> <Param name =" command "value =" minimize "> </Object> <button onclick =" Min. click () "> minimize the window </button>
  • Full Screen code
  • <Input type = "button" name = "fullscreen" value = "full screen" onclick = "window. open (document. location, 'butong _ net', 'fullscreen ') ">
  • Close Window
  • <Object ID = closes type = "application/X-oleobject" classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11 "> <Param name =" command "value =" close "> </Object> <input type =" button "value =" Close Window "onclick =" closes. click (); ">
  • Close Window
  • <Input type = button value = Close Window onclick = "javascript: Self. Close ()">
  • Maximize
  • <Object ID = big classid = "CLSID: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
  • <Param name = "command" value = "maximize"> </Object> <input type = button value = maximized onclick = big. Click ()>
  • Disable Input Method
  • <Input style = "ime-mode: Disabled" value = Disable the input method>
  • Link button 1
  • <Input type = "button" value = "link button 1" onclick = "window. open ('HTTP: // www.winliuxq.com/', 'sample', 'toolbar = No, location = No, directories = No, status = No, menubar = No, scrollbars = No, resizable = Yes, copyhistory = Yes, width = 790, Height = 520, Left = 0, Top = 0') "name =" input ">
  • Link button 2
  • <Input type = "button" name = "button" value = "link button 2" onclick = "showmodaldialog ('HTTP: // www.winliuxq.com/')">
  • Link button 3
  • <Input type = "Submit" value = "link button 3" onclick = "location. href = 'HTTP: // www.winliuxq.com/'">
  • Warning box displaySource code
  • <Button onclickpolicalert(document.doc umentelement. outerhtml) style = "width: 110"> the source code is displayed in the warning box. </button>
  • Click to clear
  • <Input type = button value = 'output' onclick = "This. style. Visibility = 'ddd'; window. Print ();">
  • Print
  • <Input type = button value = 'print 'onclick = "window. Print ();">
  • Print preview
  • <Object classid = "CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2" Height = 0 id = WB name = WB width = 0> </Object>
  • <Input type = button value = print preview onclick = "wb.exe CWB (7,1)">
  • Save
  • <Input onclick = "document.execcommand('saveas', 'true', 'common code .htm')" type = button value = Save As>
  • Click auto copy
  • <SCRIPT> function ocopy(objpolic{obj.select(;;js=obj.createtextrange(;;;js.exe ccommand ("copy")} </SCRIPT>
  • <Input type = "text" value = "Click auto copy" onclick = "ocopy (this)" size = "11">
  • Automatically Selected
  • <Input value = "automatically select" onfocus = "This. Select ()" onmouseover = "This. Focus ()" size = "11">
  • Open source code
  • <Button onclick = "document. Location = 'view-Source: '+ document. Location" size = "7"> open source code </button>
  • Delayed opening of new window
  • <Input type = button value = new window delayed onclick = javascript: setTimeout ("window. Open ('HTTP: // www.winliuxq.com/')", 10000)>
  • Implement the First Half of the selected text box
  • <Input type = "text" value = "select the first half of the content in the text box" size = 30 onmouseover = "this. select (); Tr = document. selection. createRange (); tr. moveend ('character ',-8); tr. select (); ">
  • <Input type = "text" value = "selected content. For non-ie, you can use this" size = 30 onmouseover = "this. selectionstart = This. value. length-4; this. selectionend = This. value. length ">
  • Click Clear Text
  • <Input type = "text" name = "artist" size = 14 value = "click to clear text" onmouseover = This. focus () onfocus = This. select () onclick = "If (this. value = 'click to clear text') This. value = ''">
  • Click Clear Text
  • <Input name = Name size = 11 value = click to clear the text onmouseover = This. focus () onblur = "If (this. value = '') This. value = 'click to clear text' "onfocus = This. select () onclick = "If (this. value = 'click to clear text') This. value = ''">
  • Equal to title ):
  • <Input type = "text" value = "" id = "AA" size = "20">
  • <SCRIPT> document. getelementbyid ("AA"). value = Document. Title; </SCRIPT>
  • Check whether IE is offline
  • <Input type = "button" value = "test" onclick = "alert (window. Navigator. Online)">
  • 11 methods for refreshing buttons
  • <Input type = button value = Refresh onclick = "history. Go (0)">
  • <Input type = button value = Refresh onclick = "location. Reload ()">
  • <Input type = button value = Refresh onclick = "location = location">
  • <Input type = button value = Refresh onclick = "location. Assign (location)">
  • <Input type = button value = Refresh onclick = "document.exe ccommand ('refresh')">
  • <Input type = button value = Refresh onclick = "window. navigate (location)">
  • <Input type = button value = Refresh onclick = "location. Replace (location)">
  • <Input type = button value = Refresh onclick = "window. Open ('own files', '_ Self')">
  • <Input type = button value = Refresh onclick = Document. All. webbrowser. execwb (22, 1)>
  • <Object classid = CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2 Height = 0 id = webbrowser width = 0> </Object>
  • <Form action = "your files"> <input type = submit value = Refresh> </form>
  • <A id = A1 href = "your files"> </a> <input type = button value = Refresh onclick = "a1.click ()">

     

  •  

  • ========================================================== ========================================================== ======================================
  • Script description:
  • Add the following code to the <body> area:
  • <A href = "#" onclickappsdocument.exe ccommand ("open")> open </a>
  • <A onclick = "too many open('i001.htm','', 'height = 300, width = 300, resizable = No, location = net '); "href =" "> open a webpage of the specified size </
  • <A href = "#" onclick = location. Replace ("view-source:" + location)> edit with notepad </a>
  • <A href = "#" onclickappsdocument.exe ccommand ("saveas")> Save As </a>
  • <A href = "#" onclickappsdocument.exe ccommand ("print")> Print </a>
  • <A href = "javascript: window. Print ();"> Print </a>
  • <A href = mailto: 429752806@163.com> send e-mail </a>
  • <A href = "#" onclickappsdocument.exe ccommand ("selectall")> select all </a>
  • <A href = "#" onclick = location. Reload ()> refresh 1 </a>
  • <A href = "#" onclick = history. Go (0)> refresh 2 </a>
  • <A href = "#" onclick = location. Replace ("view-source:" + location)> View source files </a>
  • <A href = "#" onclick = Window. Open (document. Location, "url", "fullscreen")> full screen display </a>
  • <A href = "#" onclick = Window. External. showbrowserui ("privacysettings", null)> Internet Options </a>
  • <A href = "#" oncontextmenu = "window. Open (this. href); Return false;"> right-click to open in a new window </a>
  • <A href = "#" onclick = history. Go (1)> forward 1 </a>
  • <A href = "#" onclick = history. Forward ()> forward 2 </a>
  • <A href = "#" onclick = history. Go (-1)> 1 </a>
  • <A href = "#" onclick = history. Back ()> 2 </a>
  • <A href = "#" onclick = Window. External. showbrowserui ("organizefavorites", null)> sort favorites </a>
  • <Span onclick = "window. external. addFavorite ('HTTP: // www.winliuxq.com/', 'webpage special effect site') "style =" cursor: Hand "Title = webpage special effect site> Add to favorites </span>
  • <A href = "#" onclick = "window. External. AddFavorite ('HTTP: // www.winliuxq.com/', 'webpage special site point')"> Add to favorites </a>
  • <A href = "javascript: window. External. AddFavorite ('HTTP: // www.winliuxq.com/', 'webpage special effect site')"> click to add to favorites </a>
  • <A href = "#" onmouseover = "window. external. addFavorite ('HTTP: // www.winliuxq.com/', 'webpage special effect site') "target =" _ Self "> Add a mouse to favorites </a>
  • <A href = "#" onmouseover = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.yiloo.com/js/'); "target =" _ Self "> set the mouse to the home page </a>
  • <A href = "javascript: window. Close ()"> close the window </a>
  • <A href = "#" onclick = Window. Close (); Return false)> close the window </a>
  • <A href = "#" onclick = setTimeout (window. Close (), 3000)> close this window in 3 seconds </a>
  • <SCRIPT>
  • Function shutwin (){
  • Window. Close ();
  • Return ;}
  • </SCRIPT>
  • <A href = "javascript: shutwin ();"> close this window </a>
  • <Span onclick = "Var strhref = Window. location. href; this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.winliuxq.com/'); "style =" cursor: Hand "> set as homepage </span>
  • Equal to the title bar: <SCRIPT> document. Write (document. Title); </SCRIPT>
  • <A href = "javascript: void (0);" onclick = 'window. External. AddFavorite (location. href, document. Title); '> Add this page to favorites </a>
  • <A href = "javascript: window. External. AddFavorite (document. Location. href, document. Title)"> Add this page to favorites </a>
  • <A href = javascript: window. External. addchannel ("Typhoon. CDF")> Add channel </a>
  • <A href = "i003.htm" onclick = "Return false;" ondblclick = "too many open('i003.htm');"> double-click to open the link </a>
  • <Style> # Close A: hover {Background: URL (javascript: window. opener = 0; window. close () ;}</style> <Div id = close> <a href = ""> close the window </a> </div>
  • <A href = "javascript: void (0)" onmouseover = "alert ('Sorry, do not select! ') "> The link is not allowed </a>
  • <A href = "" onmouseover = "alert ('site Domain Name: http://www.winliuxq.com/'); Return true;"> remember this site domain name </a>
  • On the left side of the scroll bar, change <HTML> to <HTML dir = "RTL">

     

  • ========================================================== ========================================================== ================================
  • Webpage translucent
  • <Body style = "filter: alpha (opacity = 50)">
  • Random background color
  • <Body>
  • <SCRIPT>
  • Document. body. style. background = (["red", "blue", "pink", "Navy", "gray", "yellow", "green", "Purple"]) [parseint (math. random () * 8)];
  • </SCRIPT>
  • The scroll bar is not displayed on the frame page:
  • <SCRIPT>
  • Self. moveTo (0, 0)
  • Self. resizeTo (screen. availwidth, screen. availheight)
  • </SCRIPT>
  • Prevent webpage Frame
  • <Script language = JavaScript>
  • If (top. location! = Self. Location ){
  • Top. Location = self. location;
  • }
  • </SCRIPT>
  • Always carry the framework
  • <Script language = "JavaScript"> <! --
  • If (window = Top) top. Location. href = "frame.htm"; // framework webpage
  • // --> </SCRIPT>
  • Automatic window Maximization
  • <Script language = "JavaScript"> <! --
  • Self. moveTo (0, 0)
  • Self. resizeTo (screen. availwidth, screen. availheight)
  • // --> </SCRIPT>
  • Automatically maximize window opening
  • <Object classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11" onreadystatechange = "If (this. readystate = 4) This. click (); "viewastext> <Param name =" command "value =" maximize "> </Object>
  • Eye-catching pop-up code
  • <SCRIPT> var color = new array; color [1] = "black"; color [2] = "white"; for (x = 0; x <3; X ++) {document. bgcolor = color [X]; If (x = 2) {x = 0 ;}</SCRIPT>
  • Cannot be saved
  • <NoScript> <IFRAME src = *. html> </iframe> </NoScript>
  • Chinese Character Library call
  • <SCRIPT>
  • For (I = 19968; I <40870; I ++) document. Write (string. fromcharcode (I ));
  • </SCRIPT>
  • Script showing current time
  • <Script language = VBScript> document. Write now </SCRIPT>
  • Show the last modified script
  • <SCRIPT> document. Write (document. lastmodified) </SCRIPT>
  • Press the F12 key to return to the home page.
  • <SCRIPT> function look (){
  • If (event. keycode = 123) {document. Location. href = http://www.winliuxq.com /}
  • }
  • If (document. onkeydown = NULL)
  • {Document. onkeydown = Look}
  • </SCRIPT>
  • Port Detection
  • Windows that cannot be minimized
  • <Body onblur = 'self. Focus (); '>
  • Link point external CSS file
  • <Style> @ import URL ("ie.css"); </style>
  • Embedded framework-call another webpage on a webpage:
  • <Object type = "text/X-scriptlet" width = "600" Height = "1000" Data = "http://www.winliuxq.com/"> </Object>
  • Refresh and change the window size
  • <Object classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11" onreadystatechange = "If (this. readystate = 4) This. click (); "viewastext> <Param name =" command "value =" maximize "> </Object>
  • Javascript implements vertical dotted lines on webpages
  • <SCRIPT> Hei = 120; D1 = 2; d2 = 2; cou = math. Floor (HEI/(d1 + D2 ));
  • Document. Write ('<Table cellspacing = 0 cellpadding = 0 width = 1 Height =' + Hei + '> ');
  • For (I = 0; I <cou; I ++) {document. write ('<tr> <TD Height =' + D2 + '> <tr> <TD Height =' + D1 + 'bgcolor = 333333> ')} </SCRIPT> </table>
  • JS page flip
  • <SCRIPT> document. write ("<a href =" + location. href. replace (/\. html/g, "_2.html") + "> 2 </a>"); </SCRIPT>
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.