Core tips: JavaScript Classic statement and its basic application
Open
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (1,1) Type=button value= open >
<object classid=clsid:8856f961-340a-11d0-a96b-00c04fd705a2 height=0 Id=webbrowser width=0></OBJECT>
Save As
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (4,1) Type=button value= Save as ><object Classid=CLSID : 8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Property
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (10,1) Type=button value= Properties ><object Classid=CLSID : 8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Print
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (6,1) Type=button value= print ><object Classid=CLSID : 8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Page Setup
<input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (8,1) Type=button value= Page Setup ><object classid= CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 Id=webbrowser width=0></object>
Refresh
<input Type=button value= Refresh Name=refresh >
Import Favorites
<input type= "button" name= "button" value= "Import Favorites" Onclick=window.external.importexportfavorites (True);>
Export Favorites
<input type= "button" Name= "Button3" value= "Export Favorites" Onclick=window.external.importexportfavorites (false);>
Add to Favorites
<input name=button2 Type=button value= Add Favorites >
Organize Favorite Folders
<input name=submit2 Type=button value= Collation Favorites >
View Original file
<input Name=button onclick=window.location = "View-source:" + window.location.href Type=button value= View Source files >
Language Settings
<input Name=button Type=button value= Language Settings >
Forward
<input name=submit onclick=history.go (1) type=submit value= forward >
Back
<input name=submit2 onclick=history.go ( -1) type=submit value= back >
Manipulating the database with Javascript
<script language= "javascript" runat= "Server" > code example for using JavaScript to write server-side connection databases var conn = new ActiveXObject ("ADODB. Connection "); Conn. Open ("Provider=SQLOLEDB.1; Data Source=localhost; User Id=sa; " + "Password=password; Initial Catalog=meizz ");
var rs = new ActiveXObject ("ADODB. Recordset "); var sql= "Select User_kind from Tbrightset where user_id= '" + account + "'";
Rs.Open (SQL, conn); if (!rs. EOF) { Sysuserkind = (RS ("User_kind") + ""). Replace (/^\s+\s+$/, ""); } Rs.close (); rs = null; Conn.close (); conn = null; </script> |
The application of CSS combined with JS
Using CSS with JavaScript can do a lot of cool dynamic page effect, now simple to give you a brief introduction of CSS with JS application. First, we need to understand the concept of events and actions. In client script, JavaScript obtains interaction with the user by responding to events. For example, when a user clicks a button or moves the mouse over a segment of text, a click event or mouse movement event is triggered, and by responding to those events, you can perform specific functions (for example, clicking the button Pop-up dialog box, moving the mouse over the text, changing the text color, and so on). Here are a few common events (with more events, please refer to the relevant information):
OnClick: Mouse click event. (refers to when the mouse is pressed and then released.) )
OnDblClick: Mouse double-clicks event. (refers to the mouse to quickly press, release, and press again when produced.) )
OnMouseDown: Mouse down event. (occurs when the mouse is pressed.) )
OnMouseUp: Mouse to release events. (refers to the mouse from the pressed state to bounce.) )
OnMouseMove: Mouse Move event. (refers to moving the mouse over a specific element.) OnMouseOver: The mouse passes the event. (refers to when the pointer moves from the outside to the element.) )
onmouseout: Mouse away event. (refers to when the mouse leaves from a specific element.) )
OnLoad: Loading events. (occurs when an image or page finishes loading.) )
OnUnload: Uninstall event. (occurs when a visitor leaves the page.) )
Onscroll: Scroll bar scrolling event. (occurs when the visitor moves up or down with the scroll.) )
After the event, we add action to the event. Here just to change the current element custom style of action, we can use this method to set two custom CSS styles, the object originally called the first style, when the mouse event to give the object to apply to the second CSS style, the resulting mouse effect, see the following example.
Insert an image into a Web page, customize an ". Out" style, and use a gray filter to make the picture black and white:
Apply this custom style to the picture, preview in the browser to the picture in black and white, we define a style ". Over", this style has no content, is empty style, the style sheet code is as follows:
<style type= "Text/css" >
<!--
. OVER {}
. Out {Filter:gray}
-->
</style> |
Then in the picture tag (IMG) Add "", meaning that when the mouse passes, the picture is over style, that is, the normal color image; When the mouse leaves, the picture is out style, that is, black and white image. Omouseover and onmouseout are mouse events, this.classname= "..." indicates that the current object's class name is ..., note that the case is not wrong, JS is very sensitive to case.
This effect is completed, save in the browser opened, the image is black and white, when the mouse moved up, the image into color, the mouse left, the image changed back to black and white. Just play your imagination, through the This.classname method can also make a lot of good-looking mouse effects.
-->