The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Javascript Code
Posted by: lol | February 22, 2009 @ 5:43am
Javascript Code
[
Download
]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <script language="JavaScript"> <!-- function Startup(){ alert("HI") document.Hi.box.value=prompt("what your name") Usertwo = document.Hi.box.value; } function Change(){ Userone = document.Hi.box.value; alert("You have been changed to " +Userone) } function changeZ(){ if (Userone==Usertwo) {"goodbye" + Userone}else{"goodbye" +Userone + "or" +Usertwo} } function compare(){ nickone = document.Hi.box1.value; nicktwo = document.Hi.box2.value; if (nickone == nicktwo) { alert("yes"); }else{ alert("no"); } } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body onLoad="Startup()" onUnLoad="changeZ()"> <body bgcolor="#999900" text="#003333" link="#006600" vlink="#FFFF00"> <table width="16%" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="57%"><a href="week 4.htm">Home</a></td> <td width="43%"><a href="Untitled-1.htmL">Events</a></td> <td width="57%"><a href="Untitled-2.html">Programming</a></td> </tr> </table> 6. Use the if statement below to say good bye to the user using the onUnLoad event and a function that check to see if the user has changed the name - if they have show an alert to say the new name as well as the original name- else just an alert with goodbye and the original name(to complete this one -you will need to have a variable to remeber what the first name entered is as well as one for the new name<br> 7. Add two text boxes to the form, when the second is changed - check to see if the entry is the same as the first text box - if so show an alert to that effect - if they are different change the second text box to be the same value as the first.<br> 8. Add yet another text box to the form and a button as well - now when a number is entered into the text box and the button is clicked (onClick event), if the number is not 15 make an prompt come up and ask for another guess - this needs to keep happening until the correct number is guessed (this will need to be a while statment)</font> </p> <form name="Hi" > Username <input type="text" name="box" onChange="Change()"><br> Compare <input type="text" name="box1" onChange="compare()"><br> Compare <input type="text" name="box2" onChange="compare()"> </form> </body> </html>
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.50 / 8
159 Votes
http://codebin.yi.org/243
page generated in 0.00 seconds