Lecture 6 –JavaScript 3
Lecture 6 – Mouseover and dealing with numbers
onMouseover actions (jsex6hint.html)
| | |
| |Variables which are used to count the number of times actions are|
| |performed |
|var cnt = 0 | |
|var cnt2 = 0 | |
| |This procedure is called by the when the mouse passes over the |
|function sausageandegg(){ |third item down (1st sausage). Note it adds 1 to the cnt |
|cnt=cnt+1; |variable and prints out the number of times the mouse has passed |
|alert("egg and sausage "); |over the image via. alert windows |
|alert(cnt); | |
|alert("times"); |Starts as an egg (egg.gif) but when mouse is passed over it is |
|} |replaced with a sausage picture. |
| |[pic] |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
|onMouseover one is added to the variable cnt2 (cnt2++;) | |
| | |
|the value of the variable is printed out along with some text | |
| | |
|alert('sausage and egg '+cnt2+' times') | |
Checking numerical values in JavaScript (jsex7hint.html)
| | |
| |Answer is assumed wrong unless changed by any of the following |
|function doit(){ |‘if’ statements |
| | |
|ans="wrong"; |A variable ‘textbox’ is given the value contained in the ‘num’ |
| |textbox. This is what the user typed in. |
|textbox=form1.num.value | |
| |Note if you are checking if a value is equal to 10 you MUST use|
|if (textbox== 10){ |two = signs |
|ans="correct you win" |e.g. if (textbox==10) |
|} | |
| |note ans=”correct you win” is ok because we are simply making the|
|if (textbox = 10000 && | |
|textbox = 10000 && textbox ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- html forms javascript and cascading style sheets
- javascript writing into html output weebly
- javascript is the scripting language of the web
- javascript is sometimes referred to as a programming
- review questions centennial college
- javascript pace university
- more advanced web page development some introductory
- html tom kleen
- lecture 6 javascript 3