JavaScript - Save Every User Input Using Cookies
I need help using javascript cookies to save the input users will fill in to many inputs within one form. I've never worked with cookies and I was wondering if someone could help me out here - the answers I've found searching the web do not work for me.
Any help is appreciated, Thanks. Similar TutorialsHello all, I would like to implement a cookie feature on my site that when a user logs in a cookie is stored for him and the next time he comes back, he doesn't have to sign in. I have researched hotscripts and javascripts but the ones I have found have to do with the "remember me" and thats not quite what I want. I tried to manipulate it but with no luck. Any help with either posting code or an article would be greatly appreciated! Thanks a bunch-Dan It will be best to use server side scripting like php for it , because user can disable his javascript in that condition your code won't work
I've been searching for how to do this, what seems simple, task. I have a form with multiple inputs and I want to be able to save them onchange, using the html5 function localStorage. Does anybody have an idea how I could go about doing this? It seems simple but I'm not very familiar with coding. Any help is appreciated! Hi, I am a beginner to javascript , I wish to learn how to create a .txt in local machine and store the data input in the textarea with the current data & time updated too. I am wondering is it possible to do so ? Please provide me a website or tutorial that I can learn about this. I tried to search it over the net but I just can't find a suitable tutorial for beginners like me. Thanks for the help. I appreaciate a lot. If I have post this thread in a wrong section, please kindly move it to a correct section as I can't find the suitable section to ask about this. Hello there, I want to build a form which invokes an ajax-function and therefore the page shouldn't reload. The problem is I don't want to avoid the autocompletion of the browser. But to save the input i have to submit the form regularly, which means 'onSubmit="return false;"' doesn't work. Is there any possibility or is this technique just impossible? Thx for reading and thinking about it! This is the current code, which works fine, but the browser doesn't save the (non-)submitted input. (The submit will be invoked by the "getSuggests()"-function.) Code: <form id="mytaste-selection" name="mytaste-selection" autocomplete="on" onSubmit="return false;"> <fieldset> <legend> Search </legend> <div style="padding: 0px 0px;"> <label class="standard">Artist:</label> <input id="mytaste-artist" name="mytaste-artist" class="standard text" type="text" autocomplete="on"/> <label class="standard">Title:</label> <input id="mytaste-title" name="mytaste-title" class="standard text" type="text" autocomplete="on"/> </div> <div class="button" onclick="getSuggests(urlEncode(getElementById('mytaste-artist').value),urlEncode(getElementById('mytaste-title').value),(getElementById('top').checked)?'top':'similar');"> Search </div> <div> <label class="standard">Top Tracks</label> <input class="standard radio" name="method_type" id="top" type="radio" checked="checked"/> <label class="standard" style="margin: 2px 2px 2px 20px;">Similar Tracks</label> <input class="standard radio" name="method_type" id="similar" type="radio"/> </div> </fieldset> </form> PS: If anything isn't clear please inform, if you also think that this issue is tricky, just answer with "Tricky" PPS: you can have a look at the page at http://mytaste.alitility.com Hey everyone - I am having some trouble with creating cookies and getting them to work for an onclick event. What I am trying to do is create a button to store cookies containing all user information with an alert message and set the expiration date one day after the visit. (This is just a project I am working on to help me understand how to create cookies.) Below is the cookies code I came up with but it doesn't seem to be functioning at all. Any help would be greatly appreciated. Thanks Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- Brooks Rogalski December 6, 2010 --> <title>ABC Outdoor Sports</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <script type = "text/javascript"> /* <![CDATA[ */ //cookie button function function cookieForm() { var equipment = document.forms[0].equipment.value; var pDate = document.forms[0].pickupDate.value; var pHour = document.forms[0].pickupHours.value; var pMin = document.forms[0].pickupMinutes.value; var rDate = document.forms[0].returnDate.value; var rHour = document.forms[0].returnHours.value; var rMin = document.forms[0].returnMinutes.value; var first = document.forms[0].firstName.value; var last = document.forms[0].lastName.value; var street = document.forms[0].street.value; var city = document.forms[0].city.value; var zip = document.forms[0].zip.value; var DoBYear = document.forms[0].date.value; var myDate = new Date(); myDate.setDay(myDate.getDay() +1) ; document.cookie = "equipment" + encodeURIComponent(equipment) + "; expires=" + mydate.toUTCString(); document.cookie = "pDate" + encodeURIComponent(pDate) + "; expires=" + mydate.toUTCString(); document.cookie = "pHour" + encodeURIComponent(pHour) + "; expires=" + mydate.toUTCString(); document.cookie = "pMin" + encodeURIComponent(pMin) + "; expires=" + mydate.toUTCString(); document.cookie = "rDate" + encodeURIComponent(rDate) + "; expires=" + mydate.toUTCString(); document.cookie = "rHour" + encodeURIComponent(rHour) + "; expires=" + mydate.toUTCString(); document.cookie = "rMin" + encodeURIComponent(rMin) + "; expires=" + mydate.toUTCString(); document.cookie = "first" + encodeURIComponent(first) + "; expires=" + mydate.toUTCString(); document.cookie = "last" + encodeURIComponent(last) + "; expires=" + mydate.toUTCString(); document.cookie = "street" + encodeURIComponent(street) + "; expires=" + mydate.toUTCString(); document.cookie = "city" + encodeURIComponent(city) + "; expires=" + mydate.toUTCString(); document.cookie = "zip" + encodeURIComponent(zip) + "; expires=" + mydate.toUTCString(); document.cookie = "DoBYear" + encodeURIComponent(DoBYear) + "; expires=" + mydate.toUTCString(); /* ]] */ </script> </head> <body onload = "rotateImage('rImage')"> <h1> ABC Outdoor Sports Equipment </h1> <img src="fishing.jpg" id="rImage" width="250" height="200" onmouseover = "pause=true;" onmouseout = "pause=false;"> <br/> <br/> <form onsubmit = "return validateForm();" action = "mailto:rogalskibf@gmail.com?subject=ABC Customer Reservation" method="post" enctype="text/plain"> <table border = "0"> <tr> <td> Equipment:<br/> <select name = "equipment"> <option value="unselected">Select Equipment Type</option> <option value = 20>Fishing Boat</option> <option value = 15>Kayak</option> <option value = 2>Mountain Bike</option> <option value = 10>Scuba Gear</option> </select> </td> </tr> <tr> <td> Pick-up Date: <br/> <input type = "text" name = "pickupDate" value = "(mm/dd/yyyy)"/> </td> <td> Pick-up Time: <br/> <select name = "pickupHours"> <option value="unselected">hr</option> <option value = 7>07</option> <option value = 8>08</option> <option value = 9>09</option> <option value = 10>10</option> <option value = 11>11</option> <option value = 12>12</option> <option value = 13>13</option> <option value = 14>14</option> <option value = 15>15</option> <option value = 16>16</option> <option value = 17>17</option> </select> <select name = "pickupMinutes"> <option value="unselected">min</option> <option value = 0>00</option> <option value = .5>30</option> </select> </td> </tr> <tr> <td> Return Date: <br/> <input type = "text" name = "returnDate" value = "(mm/dd/yyyy)"/> </td> <td> Return Time: <br/> <select name = "returnHours"> <option value="unselected">hr</option> <option value = 7>07</option> <option value = 8>08</option> <option value = 9>09</option> <option value = 10>10</option> <option value = 11>11</option> <option value = 12>12</option> <option value = 13>13</option> <option value = 14>14</option> <option value = 15>15</option> <option value = 16>16</option> <option value = 17>17</option> </select> <select name = "returnMinutes"> <option value="unselected">min</option> <option value = 0>00</option> <option value = .5>30</option> </select> </td> </tr> <tr> <td> First Name: <br/> <input type = "text" name = "firstName"/> </td> <td> Last Name: <br/> <input type = "text" name = "lastName"/> </td> </tr> <tr> <td> Street: <br/> <input type = "text" name = "street"/> </td> <td> City: <br/> <input type = "text" name = "city"/> </td> <td> Zip:<br/> <input type = "text" name = "zip" maxlength = "5"/> </td> </tr> <tr> <td> Date of Birth: <br/> <input type = "text" name = "date" value = "(mm/dd/yyyy)"/> </td> </tr> <tr> <td colspan = "3" align = "center"> <input type = "submit" name = "submit" value = "Submit Reservation"/> <input type = "button" name = "cookies" value = "Store User Information"/> </td> </tr> </table> </form> </body> </html> So I have been working on this exercise for about a month. In the book I am reading it say's this:"For each number that the user enters, the text boxes on the web page should display: the last score that was entered, the number of scores that have been entered, the total of these scores, the average score, the best score, and the worst score. When you write the code for this function, you should enclose the prompt method within a loop, but you decide which type of loop is best for this application. Now, write and test the code." The first peice of code is my HTML, and the second piece of code is the function that I have to start from in a .js file. I just seem to be confused at how my structuring needs to be. The 999 in the function is what the prompt says to enter to escape. Code: <body> <div id="content"> <h1>Using Loops</h1> <label for="lastScore">Last Sco </label> <input type="text" id="lastScore" /><br /> <p></p> <label for="scoreCount">Score Count:</label> <input type="text" id="scoreCount" /><br /> <label for="scoreTotal">Score Total:</label> <input type="text" id="scoreTotal" /><br /> <p></p> <label for="scoreAverage">Average Sco </label> <input type="text" id="scoreAverage" /><br /> <label for="bestScore">Best Sco </label> <input type="text" id="bestScore" /><br /> <label for="worstScore">Worst Sco </label> <input type="text" id="worstScore" /><br /> <p></p> </div> Code: var process_test_scores = function () { var testScore; testScore = parseInt(prompt( "Enter a valid test score between 0 and 100.\n" + "To end test score entry, enter 999.", 999)); } _________
Hello all, First off I would like to say a big hello and thank you to the forum for helping me with code over the years... I am trying to create an iframe with a user input, however, I dont simply want the iframe to display the URL the user has entered in the iframe. I want it to be used within a URL string. For example: The iframe should display http://www.google.co.uk/search?q=UserKeyword I havent got a clue where to start from.... Any help would be highly appreciated! Thanks! In a normal chatroom, when the user "says" something, the text will be displayed normally on a line with the date/time attached like the example below. 2011/11/09 Capypara: Blah balh blah I would like to make it so that the text typed in by the user will appear inside a graphic (square, or those chat bubbles) like the example below. The graphic will only appear when a user says something, so essentially both the graphic and the text will appear together. ~~~~~~~~~~~~~~~~~~~~~~~~ | | | 2011/11/09 Capypara: Blah balh blah | | | ~~~~~~~~~~~~~~~~~~~~~~~~ Is it possible to go about doing this? Thanks for reading this. Hey, so i've been learning basics and I can get the following code to work as a prompt and I thought hey, I wounder if I can get it to work of a UI system, so I edited the code and got this Read Below Post Can you please help me to find where I am going wrong. Thanks MancunianMacca Is there any possible way for JS to save changes that a user has made? my situation is that I'm a photographer who offers photobooks. My customers often have hundreds or thousands of photos and want captions on lots of them. I want to post a photo gallery with a user input form. I've created a simple form, but I want the user to be able to save comments straight to the gallery so I can look at them... it's only a very simple form and isn't quite finished yet, oh by the way, I'm not sure how to use the check box... but, i'll work on that. Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <style type="text/css"> <!-- #divWrapper { text-align: center; width: 430px; margin-right: auto; margin-left: auto; } --> </style> </head> <body> <script type="text/javascript"> function picForm() { if(document.frmInput.addPic.value="yes") { document.frmOutput.outChoice.value="will" } else { document.frmOutput.outChoice.value="will NOT" } document.frmOutput.outCap.value=document.frmInput.addCap.value; document.frmOutput.outComm.value=document.frmInput.addComm.value; } </script> <div id="divWrapper"> <p>Uncheck the box if you do NOT want this photo to appear in your photobook. Please write your caption in the box provided. Any further comments you wish to make can be entered in the second box.</p> <div id="divInput"> <form name="frmInput"> <table id="tblForm" cellpadding="3px"> <tr> <td><input name="addPic" type="checkbox" value="yes"> Add to Photobook</td> <td> </td> </tr> <tr> <td>Caption<br> <textarea name="addCap" cols="24" rows="3" value="...Add Caption Here..."></textarea></td> <td>Comments<br> <textarea name="addComm" cols="24" rows="3" value="...Add Comments Here..."></textarea></td> </tr> <tr> <td></td> <td><div align="right"> <input name="btnSubmit" type="button" value="Submit" onClick="picForm()" /> </div></td> </tr> </table> </form> </div> <div id="divOutput"> <form name="frmOutput"> <p>This photo <input name="outChoice" type="text" value="" size="7" style="border:0px" /> appear in your photo book.</p> <p>You would like the caption to read: <input name="outCap" type="text" value="" size="50" style="border:0px" /> </p> <p>Your comments to us a <input name="outComm" type="text" value="" size="50" style="border:0px" /> </p> </form> </div> </div> </body> </html> Please help! Dear expert (Ok, i am new to this and should maybe not address this as a letter ) I hope someone can help me ... this is what i want to achieve (I am using frontpage) I want to create a table (this i can do!) that require a user input (number of guests). It then has SEVERAL options: - Select an option from a drop down list, and a price is then loaded from somewhere to create a total for that option and display it in the table (And keep that total for adding later) - Check a box, and if checked it creates a further calculation, displaying and storing the number for further calculation. a number of the above options, and a grand total on the bottom. I found more or less a page on a site that does what i am looking for, but after looking at the code, i have even LESS of an idea how it works Can someone PLEASE help me, or point me in the right direction? (I am not looking for someone to just write the code for me, as this will not teach me anything, and i want to learn) Below is a link to the example .. http://www.ouma-se-kombuis.co.za/test.html Thank you! Hey guys, I just joined the forums (literally) and just started coding (mainly with CSS and HTML) about 3-4 weeks ago. I'd really like to get into JavaScript to make cool things happen on my website. With that being said, I've come up with a pretty cool idea but am not sure how to go about my problem. Enough with the chit chat. What I'm trying to do is add text to a user's input. For instance, if they write "Hello", the function should automatically add "World" to the output. I'd ideally like for the output to be searched on Google (think search engine) with the results displayed on a new page. Thanks in advance for any help! Hi there, I'll try to be brief: When a user submits a website in the input field on my site, I'd like there to be a background process that takes a screenshot of that website and then displays that image to the user. This website does it perfectly. The user writes the website to the right, and the screenshot is displayed to the left. I'm looking for a free alternative, and read that perhaps webkit(s) might be the solution? I'm a total newbie when it comes to this so any feedback is gold to me. Thank you so much guys/gals. Okay, so I've created a JavaScript form which allows the user to enter their name into the form and display it within the sentence, "Welcome to the site ______". It works on one page, but, problem is, I'd like it to be displayed on every page. I'm aware you cannot do this with getElementbyId (can only be used once), which is what I've used. I've tried using getElementsbyClass, but from my understanding, it's not as simple as that. Here's my code so far anyway: Code: <script type="text/javascript"> function inputname(){ var userInput = document.getElementById('userInput').value; document.getElementById('welcome').innerHTML = userInput; } </script> Code: <p>Welcome to the site <b id='welcome'></b> </p> <input type='text' id='userInput' /> <input type='button' onclick='inputname()' value='Enter Name'/> Hi I have a form with some input tags, and when the user submit the form I which if a new hidden tag get submitted with the value the user did tip. I am thinking for doing that but not sure if it is the right thing : Code: <form method="POST" <input type="text" name="{actionForm.Name}" id="username"> <input type="password" name="{actionForm.Passwd}" id="password"> <input type="hidden" name="usernameh" value="document.getElementById('username')"> <input type="hidden" name="passwordh" value="document.getElementById('password')"> </form> Is it alright ? I mean when the user enter the username and password, the hidden tags should contain those two values that the user has made. Hey everyone, I've looked around quite a bit and can't seem to find anything but I was wondering if there is some open source software offering a text editor/input field similar to the one used on this forum when submitting a comment or thread? Where you can click a bold button or Italic button or URL button to structure it? Thanks Josh The assignment is to take a form and determine whether or not the user has put in data into the parts of the form. We are using Javascript to validate the form input and html to create the form itself. My code was running before, but then I added a confirm user input at the bottom of the form and it stopped working. I have no idea what to do at this point. Any help would be useful. I don't have any error messages because I don't know how to test it in the firefox javascript console, if someone wants to instruct me on this i can get back to you guys with the error messages. Thanks Also, my submit button has not been running the validate program when selected. Code: <html> <head> <title>Order Form</title> <script language="javascript"> function validate(objForm) { str=""; checkstr=""; checkstr2=""; stateselect = "false"; //VALIDATING CONTACT INFORMATION if (objForm.firstName.value == "") { str+= "You must enter your First Name\n"; } if (objForm.lastName.value == "") { str+= "You must enter your Last Name\n"; } if (objForm.phoneNumber.value == "") { str+= "You must enter a Phone Number\n"; } //VALIDATING SHIPPING ADDRESS if (objForm.address.value == "") { str+= "You must enter an address\n"; } if (objForm.city.value == "") { str+= "You must enter a city\n"; } for(i=1; i<objForm.state.options.length; i++) { if (objForm.state.options[i].selected) stateselect = "true"; } if (stateselect != "true") str+= "You must select a state\n"; if(isNaN(myForm.zipcode.value)||myForm.zipcode.value.length!=5) { str+= "You must enter a 5 digit zipcode\n"; } //VALIDATING CHECK BOX if (!objForm.doublechocchip.checked && !objForm.vanillachip.checked && !objForm.zebra.checked && !objForm.tiger.checked && !objForm.choccoveredstrawberry.checked && !objForm.mintcchochip.checked && !objForm.raspberry.checked && !objForm.redvelvet.checked && !objForm.kailua.checked && !objForm.blackforest.checked && !objForm.peanutbutter.checked && !objForm.mandm.checked && !objForm.oreo.checked && !objForm.mocha.checked && !objForm.gingerbread.checked && !objForm.pumpkin.checked && !objForm.pistachio.checked && !objForm.lavender.checked && !objForm.carrotcake.checked && !objForm.strawberrybanana.checked) str+= "You must select at least one cupcake\n"; //VALIDATING CHECKED BOXES if (objForm.doublechocchip.checked) checkstr += objForm.doublechocchip.value + ", "; if (objForm.vanillachip.checked) checkstr += objForm.vanillachip.value + ", "; if (objForm.zebra.checked) checkstr += objForm.zebra.value + ", "; if (objForm.tiger.checked) checkstr += objForm.tiger.value + ", "; if (objForm.choccoveredstrawberry.checked) checkstr += objForm.choccoveredstrawberry.value + ", "; if (objForm.mintchocchip.checked) checkstr += objForm.mintchocchip.value + ", "; if (objForm.raspberry.checked) checkstr += objForm.raspberry.value + ", "; if (objForm.redvelvet.checked) checkstr += objForm.redvelvet.value + ", "; if (objForm.kailua.checked) checkstr += objForm.kailua.value + ", "; if (objForm.blackforest.checked) checkstr += objForm.blackforest.value + ", "; if (objForm.peanutbutter.checked) checkstr += objForm.peanutbutter.value + ", "; if (objForm.mandm.checked) checkstr += objForm.mandm.value + ", "; if (objForm.oreo.checked) checkstr += objForm.oreo.value + ", "; if (objForm.mocha.checked) checkstr += objForm.mocha.value + ", "; if (objForm.gingerbread.checked) checkstr += objForm.gingerbread.value + ", "; if (objForm.pumpkin.checked) checkstr += objForm.pumpkin.value + ", "; if (objForm.pistachio.checked) checkstr += objForm.pistachio.value + ", "; if (objForm.lavender.checked) checkstr += objForm.lavender.value + ", "; if (objForm.carrotcake.checked) checkstr += objForm.carrotcake.value + ", "; if (objForm.strawberrybanana.checked) checkstr += objForm.starwberrybanana.value + ", "; //VALIDATING CHECK BOX if (!objForm.mini.checked && !objForm.regular.checked && !objForm.collossal.checked) str+= "You must select a size\n"; //VALIDATING CHECKED BOXES if (objForm.mini.checked) checkstr2 += objForm.mini.value + ", "; if (objForm.regular.checked) checkstr2 += objForm.regular.value + ", "; if (objForm.collossal.checked) checkstr2 += objForm.collossal.value + ", "; //print all form input if (str != ""){ alert(str); return false; } else{ str= "Please Confirm Your Information:"; str += "\nFirst Name: " +objForm.firstName.value; str += "\nLast Name: " +objForm.lastName.value; str += "\nPhone Number: " +objForm.phoneNumber.value; str += "\nAddress: " +objForm.address.value; str += "\nCity: " +objForm.city.value; str += "\nZip Code: " +objForm.zipcode.value; str += "\nCupcakes: " +checkstr; str += "\nSize: " +checkstr2; alert(str); return true; } } </script> </head> <link rel="stylesheet" type="text/CSS" href="CellFormating.css"/> <body onLoad="document.forms[0].elements[0].focus()"> <h2 align="center" class="CellFormat1"> Please Use the Following Form to Place Your Order: </h2> <form id ="CellFormat2" name="myForm" method="post" action="orderconfirmation.html" onSubmit="return validate(myForm)"> <table align="center"> <tr> <td id="CellFormat4">Contact Information:</td> </tr> <tr> <td>First Name: </td> <td><input name="firstName" size="15" /></td> </tr> <tr> <td>Last Name: </td> <td><input type="text" name="lastName" size="15" maxlength="20" /></td> </tr> <tr> <td>Phone Number: </td> <td><input type="text" name="phoneNumber" size="10" maxlength="10" /></td> </tr> </table> <p> </p> <table align="center"> <tr> <td id="CellFormat4">Shipping Address:</td> </tr> <td>Address: </td> <td><input type="text" name="address" size="22" maxlength="30" /></td> </tr> <tr> <td>City: </td> <td><input type="text" name="city" size="10" maxlength="15" /></td> </tr> <tr> <td>State: </td> <td> <select name="state" size="1"> <option selected>Select your State</option> <option>Alabama</option> <option>Alaska</option> <option>Arizona</option> <option>Arkansas</option> <option>California</option> <option>Colorado</option> <option>Connecticut</option> <option>Delaware</option> <option>Florida</option> <option>Georgia</option> <option>Hawaii</option> <option>Idaho</option> <option>Illinois</option> <option>Indiana</option> <option>Iowa</option> <option>Kansas</option> <option>Kentucky</option> <option>Louisiana</option> <option>Maine</option> <option>Maryland</option> <option>Massachusetts</option> <option>Michigan</option> <option>Minnesota</option> <option>Mississippi</option> <option>Missouri</option> <option>Montana</option> <option>Nebraska</option> <option>Nevada</option> <option>New Hampshire</option> <option>New Jersey</option> <option>New Mexico</option> <option>New York</option> <option>North Carolina</option> <option>North Dakota</option> <option>Ohio</option> <option>Oklahoma</option> <option>Oregon</option> <option>Pennsylvania</option> <option>Rhode Island</option> <option>South Carolina</option> <option>South Dakota</option> <option>Tennessee</option> <option>Texas</option> <option>Utah</option> <option>Vermont</option> <option>Virginia</option> <option>Washington</option> <option>West Virginia</option> <option>Wisconsin</option> <option>Wyoming</option> </select> </td> </tr> <tr> <td>Zip Code: </td> <td><input type="text" name="zipcode" size="10" maxlength="15" /></td> </tr> </table> <p> </p> <table align="center"> <tr> <td><div align="center" id="CellFormat4">Select Your Cupcakes:</div></td> <td><div align="center" id="CellFormat4">Select Your Size(s):</div></td> <td><div align="center" id="CellFormat4">Select The Amount:</div></td> </tr> <tr> <td><input type="checkbox"name="doublechocchip" value="doublechocchip"/>Double Chocolate Chip</td> <td><input type="checkbox"name="mini" value="mini"/>Mini</td> <td>Amount: <input type="text" name="amt" size="5" maxlength="10" /></td> </tr> <tr> <td><input type="checkbox"name="vanillachip" value="vanillachip"/>Vanilla Chip</td> </tr> <tr> <td><input type="checkbox"name="zebra" value="zebra"/>Zebra</td> <td><input type="checkbox"name="regular" value="regular"/>Regular</td> </tr> <tr> <td><input type="checkbox"name="tiger" value="tiger"/>Tiger</td> </tr> <tr> <td><input type="checkbox"name="choccoveredstrawberry" value="choccoveredstrawberry"/>Chocolate Covered Strawberry</td> <td><input type="checkbox"name="collosal" value="collossal"/>Collossal</td> </tr> <tr> <td><input type="checkbox"name="mintchocchip" value="mintchocchip"/>Mind Chocolate Chip</td> </tr> <tr> <td><input type="checkbox"name="raspberry" value="raspberry"/>Raspberry</td> </tr> <tr> <td><input type="checkbox"name="redvelvet" value="redvelvet"/>Red Velvet</td> </tr> <tr> <td><input type="checkbox"name="kailua" value="kailua"/>Kailua</td> </tr> <tr> <td><input type="checkbox"name="blackforest" value="blackforest"/>Black Forest</td> </tr> <tr> <td><input type="checkbox"name="peanutbutter" value="peanutbutter"/>Peanut Butter</td> </tr> <tr> <td><input type="checkbox"name="mandm" value="mandm"/>M&M's</td> </tr> <tr> <td><input type="checkbox"name="oreo" value="oreo"/>Oreo</td> </tr> <tr> <td><input type="checkbox"name="mocha" value="mocha"/>Mocha</td> </tr> <tr> <td><input type="checkbox"name="gingerbread" value="gingerbread"/>Gingerbread</td> </tr> <tr> <td><input type="checkbox"name="pumpkin" value="pumpkin"/>Pumpkin</td> </tr> <tr> <td><input type="checkbox"name="pistachio" value="pistachio"/>Pistachio</td> </tr> <tr> <td><input type="checkbox"name="lavender" value="lavender"/>Lavender</td> </tr> <tr> <td><input type="checkbox"name="carrotcake" value="carrotcake"/>Carrot Cake</td> </tr> <tr> <td><input type="checkbox"name="strawberrybanana" value="strawberrybanana"/>Strawberry Banana</td> </tr> </table> <p> </p> <div align="center" id="CellFormat4">Payment Method:</div> <table align="center"> <tr> <td>Credit Card Type: </td> </tr> <tr> <td>Visa:<input type="radio" name="visa" value="visa" /></td> <td>Master Card:<input type="radio" name="master" value="master" /></td> <td>Discovery:<input type="radio" name="discovery" value="discovery" /></td> <td>Chase:<input type="radio" name="chase" value="chase" /></td> </tr> <tr> <td>Credit Card Number: </td> <td><input type="text" name="creditNumber" size="12" maxlength="12" /></td> </tr> <tr> <td>Expiration Date: </td> <td><input type="text" name="ExpDate" size="5" maxlength="5" /></td> </tr> <tr> <td>Security Code: </td> <td><input type="text" name="SecurityCode" size="3" maxlength="3" /></td> </tr> </table> <p> </p> <table align="center"> <tr> <td><textarea rows="10" cols="25" wrap="soft">Please let us know how we are doing</textarea></td> </tr> </table> <table align="center"> <tr> <td><input type="submit" name="Order" value="Submit Order" onSubmt="return validate(myForm)";/></td> <td><input type="button" name="confirm" value="Confirm Information" onClick="validate(myForm)"/></td> <td><input type="reset" name="Clear" value="Reset"/></td> </tr> </table> </form> <table align="center"> <tr> <td><a href="cupcakes.htm">View the Cupcakes</a></td> <td><a href="home.html">Go Home!</a></td> </tr> </table> </body> </html> Spent past few days helping my son for his project of manipulating bouncing ball. Please help me this script work. Once user inputs the new ani value, the ball goes out. I want user to set any value ani, int and size of the ball to achieve desired animation. Seriously urgent... Thanks! <HTML> <HEAD> </HEAD> <BODY> <IMG ID="ball" STYLE="position: absolute; left: 325; top: 200; width: 30; height: 30;" SRC="images/ball1.gif"> <SCRIPT LANGUAGE="JavaScript"> function showAlert() { alert('ANI=' + ani + ', INT=' + int + ', SIZE=' + wxh + ''); } </SCRIPT> <SCRIPT LANGUAGE="JavaScript1.2"> <!-- var myBall = document.getElementById("ball"); var loc = 200; var ani = 10; var direction = 0; var int = 50; var wxh = 30; setInterval("myFunction()", int); function myFunction(){ if(0 == direction) { /* move down */ loc += ani; if(loc >= 500) { /* reached lower limit, change direction */ direction = 1; } } else { /* move up */ loc -= ani; if(loc < 10) { /* reached upper limit, change direction */ direction = 0; } } myBall.style.top = loc; } // --> </SCRIPT> <SCRIPT LANGUAGE="JavaScript1.2"> function readText (form) { if(form.f_ani.value != ""){ ani = form.f_ani.value ; myBall = document.getElementById("ball"); loc = 200; direction = 0; int = 50; setInterval("myFunction()", int); myFunction(); } showAlert(); } </SCRIPT> <FORM action="" method="Get"> Ball Movement (10 pixels):<input type='text' NAME="f_ani" value="10" size="20"><br> Interval (200 milliseconds):<INPUT type="text" id="f_int" value="200" size="20" name="1"><br> Ball Size (10 pixels W&H):<INPUT type="text" id="f_size" value="30" size="20" name="2"><br> <input type='button' value='Send' onclick="readText(this.form)"> <INPUT type="reset"> </FORM> </BODY> </HTML> |