common event in js

/ / 1: onblur event occurs when the object loses focus
function upperCase ()
(
var x = document.getElementById ( "fname"). value
document.getElementById ( "fname"). value = x.toUpperCase ()
)
</ script>

Enter your name:
<input type="text" />

/ / 2: onabort events will be interrupted when the image is loaded happen.
<script type="text/javascript">
function abortImage ()
(
alert ( 'Error: Loading of the image was aborted')
)
</ script>
</ head>

<body>
<img src="image_w3default.gif" onabort="abortImage()" />
</ body>

/ / 3: onchange event in the domain of content changes happen
<script type="text/javascript">
function upperCase (x)
(
var y = document.getElementById (x). value
document.getElementById (x). value = y.toUpperCase ()
)
</ script>
</ head>
<body>
Enter your name:
<input type="text" onchange="upperCase(this.id)" />

/ / 4: onclick when the user clicks on an object when the event handler calls.
/ / 5: onclick when an object when the user double-click event handler calls.

/ / 6: onerror event will be in the document or image loading process is triggered when an error occurs.
<img src="image.gif" />

/ / 7: onfocus incident happened when the object was the focus.
<script type="text/javascript">
function setStyle (x)
(
document.getElementById (x). style.background = "yellow"
)
</ script>
</ head>
<body>
First name: <input type = "text"
onfocus = "setStyle (this.id)" />
<br />
Last name: <input type = "text"
onfocus = "setStyle (this.id)" />
</ body>

/ / 8: onkeydown event in the user press a keyboard button when
<script type="text/javascript">
function noNumbers (e)
(
var keynum
var keychar
var numcheck
if (window.event) / / IE
(
keynum = e.keyCode
)
else if (e.which) / / Netscape / Firefox / Opera
(
keynum = e.which
)
keychar = String.fromCharCode (keynum)
numcheck = / \ d /
return! numcheck.test (keychar)
)
</ script>
<form>
<input type="text" onkeydown="return noNumbers(event)" />
</ form>

/ / 9: onkeyup event will be at the keyboard when keys are released
<script type="text/javascript">
function upperCase (x)
(
var y = document.getElementById (x). value
document.getElementById (x). value = y.toUpperCase ()
)
</ script>
</ head>
<body>
Enter your name: <input type="text" onkeyup="upperCase(this.id)" />
</ body>

/ / 10: onload event of the page or image is loaded immediately after the completion of (onload when the page finished loading in the status bar shows a section of text)
<script type="text/javascript">
function load ()
(
window.status = "Page is loaded"
)
</ script>
</ head>
<body onload="load()">
</ body>

/ / 11: onmousedown event will be the mouse button is pressed happen (the dialog box will show you click on the element tag name)
<script type="text/javascript">
function whichElement (e)
(
var targ
if (! e) var e = window.event
if (e.target) targ = e.target
else if (e.srcElement) targ = e.srcElement
if (targ.nodeType == 3) / / defeat Safari bug
targ = targ.parentNode
var tname
tname = targ.tagName
alert ( "You clicked on a" + tname + "element.")
)
</ script>
</ head>
<body onmousedown="whichElement(event)">
<h2> This is a header </ h2>
<p> This is a paragraph </ p>
<img border="0" src="ball16.gif" alt="Ball">
</ body>

/ / 12: onmousemove event occurs when the mouse pointer movement
<img src="/i/eg_mouse2.jpg" alt="mouse" onmousemove="alert(' Your mouse just after pictures !')" />

/ / 13: onmouseout event is the mouse pointer out of the designated object happen
<img src="/i/example_mouse2.jpg" alt="mouse" onmousemove="alert(' Your mouse have just left the picture !')" />

/ / 14: onmouseover time the mouse pointer will move to the designated object happen when
<img src="/i/eg_mouse2.jpg" alt="mouse""alert(' Your mouse on the picture !')" />

/ / 15: onmouseup event will be release the mouse button when
<img src="/i/eg_mouse2.jpg" alt="mouse" onmouseup="alert(' You click on the picture !')" />

/ / 16: onresize incident would have been in the window or frame size adjust happen (when the user tries to adjust the size of the window will display a dialog box)
<body onresize="alert('You have changed the size of the window')">
</ body>

/ / 17: onselect event text in the text box is selected when
<form>
Select text: <input type = "text" value = "Hello world!"
onselect = "alert ( 'You have selected some of the text.')" />
Select text: <textarea cols = "20" rows = "5"
onselect = "alert ( 'You have selected some of the text .')">
Hello world! </ Textarea>
</ form>

/ / 18: onunload event in the user exit when the page (turn off when the page will display a dialog box)
<body onunload="alert('The onunload event was triggered')">
</ body>
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of common event in js

  • hibernate using c3p0 connection pooling

    Private http://www.lifevv.com/tenyo/doc/20070605102040991.html c3p0 for open source's JDBC connection pool, with the release hibernate. This article describes how to use the hibernate configuration in c3p0. c3p0 connection pool configuration is v ...

  • Hibernate configuration parameters hibernate.hbm2ddl.auto

    Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...

  • Build flex + spring + blazeds + hibernate application

    Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...

  • Process migration from tomcat to websphere changes

    Process migration from tomcat to websphere changes Because customers use the web application server software used by different what tomcat5, tomcat6, websphere5.1, websphere6.1, weblogic8, and so on, and the software used inconsistent standards, ibm's

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15

  • hibernate generic generic DAO

    package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Hibernate secondary cache

    Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries