JavaScript - Multiple Emails
I have what would seem like an easy task, but is not working out that way. I have a basic html form with multiple user input boxes. Upon the submit button being clicked it validates the input with javascript and then emails the information with the forms mailto. What I need it to do, is email everything but the information in one textbox to a group of recipients, and the email all of the items to a different recipient. This need to be done to prevent certain induviduals from seeing certain items filled out on the form. I know this can easily be done in asp, php, or a server-side client of the sort, but we do not have access to any resources like this in this area of the company. I'm open for any suggestions you may have.
Thanks ahead of time. Similar TutorialsI have three radio button groups with different values. My script only works for one group. Please help! <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script> function emailTo(){ var emails = document.getElementsByName("email1"); var emailAdress = null; for(var i = 0; i < emails.length; i++){ if(emails[i].checked){ emailAdress = emails[i].value; } } if(emailAdress == null){ alert("select the email address"); return; } var mailto_link = 'mailto:'+emailAdress; var win = window.open(mailto_link,'emailWindow'); if (win && win.open &&!win.closed) win.close(); } </script> </head> <body> <p> <input type = "radio" name = "email1" value = "email1.com"/> recipient 1a <input type = "radio" name = "email1" value = "email1.com"> recipient 1b </p> <p> <input type = "radio" name = "email2" value = "email2.com"/> recipient 2a <input type = "radio" name = "email2" value = "email2.com"> recipient 2b</p> <p> <input type = "radio" name = "email3" value = "email3.com"/> recipient 3a <input type = "radio" name = "email3" value = "email3.com"> recipient 3b</p> <p> </p> <p> <input type = "button" onClick = "emailTo()" value = "Email"/> </p> </body> </html> So I have a new window document write which outputs all my data after validation into a new window, I have tried to write a button which will (when clicked) send that information to an email address. here is my code so far. i spent about 2 hours checking and playing around looking for errors couldnt find any. I think the problem is the function EmailForm and function subwrite. Is a button written into a new window a common thing to do? or is there another simpler way, however i want the user to be able to check to see if there data is valid and then click to send the email. Code: <HTML> <!--learn to program through JavaScript--> <mymerch.HTML> <HEAD> <TITLE> mymerch </TITLE> <SCRIPT LANGUAGE=JavaScript> //declaringvariables var firname; var surname; var phonenumber; var emailaddress; var streetnamenumber; var yoursuburb; var postcode; var yourstate; var product1; var product2; var product3; var product4; var product5; var product6; var product7; var product8; var totalc; var paymethods; var method; var value; var Cost; var numericExpression; var alphaExpression; var sendemail; var subject; var message; var mailto_link; var win; function main() { //open function main //function main which validates all data //declaring variables firname = document.merch.firstname.value; surname = document.merch.lastname.value; phonenumber = document.merch.phonenum.value; emailaddress = document.merch.emailadd.value; streetnamenumber = document.merch.stnamenum.value; yoursuburb = document.merch.suburb.value; postcode = document.merch.pcode.value; yourstate = document.merch.state.value; if (firname == "") { alert("Please fill in your Firstname.") document.merch.firstname.value.focus() return true; } //checks to see if no data as been entered and alerts the user if so. alphaExpression = /[a-zA-z]/; if(document.merch.firstname.value.match(alphaExpression)){ }else{ alert("You can only enter letters in the firstname field") document.merch.firstname.value.focus() return false; } //checks to see if the data entered is letter and if not true returns false. if (surname == "") { alert("Please fill in your Surname.") document.merch.lastname.value.focus() return false } //checks to see if no data as been entered and alerts the user if so. alphaExpression = /[a-zA-z]/; if(document.merch.lastname.value.match(alphaExpression)){ }else{ alert("You can only enter letters in the lastname field") document.merch.lastname.value.focus() return false; } //checks to see if the data entered is letter and if not true returns false. numericExpression = /^[0-9+\ ]+$/; if(document.merch.phonenum.value.match(numericExpression)){ }else{ alert("You can only enter numbers in the Phonenumber field") document.merch.phonenum.value.focus() return false; } //checks to see if the data entered is a number and if not true returns false. if(document.merch.phonenum.value.length <7) { alert("The Phone Number you have entered is not valid it contains less than 7 digits.") document.merch.phonenum.focus() return false } //checks to see if the phone number is less than 7 and if so returns false. if(document.merch.phonenum.value.length >10) { alert("The Phone Number you have entered is not valid it contains more than 10 digits.") document.merch.phonenum.focus() return false } //If phone number is more than 10 return false if (emailaddress == "") { alert("Sorry, your email address is not valid. You didn't enter anything."); document.merch.emailadd.focus() return false } //checks to see if no data as been entered and alerts the user if so. if (emailaddress.indexOf("@")==-1) { alert("Sorry, your email address is not valid. It doesn't have an @ symbol"); document.merch.emailadd.focus() return false } //checks to see if the data has an "@" and alerts the user if false. if (emailaddress.indexOf(".")==-1) { alert("Sorry, your email address is not valid. It doesn't have .COM"); document.merch.emailadd.focus() return false } //checks to see if the data has an dot and alerts the user if false. if (emailaddress.indexOf(" ")!=-1) { alert("Sorry, your email address is not valid. It has a space!"); document.merch.emailadd.focus() return false } //checks to see if the data has an space and alerts the user if false. if (streetnamenumber == "") { alert("Please fill in your Street Name and Number.") document.merch.stnamenum.value.focus() return false } //checks to see if the data is empty and alerts the user if true. if (document.merch.suburb.value == "") { alert("Please fill in your Suburb.") document.merch.suburb.value.focus() return false } //checks to see if the data is empty and alerts the user if true. alphaExpression = /[a-zA-z]/; if(document.merch.suburb.value.match(alphaExpression)){ }else{ alert("You can only enter letters in the Suburb field") document.merch.suburb.value.focus() return false; } //checks to see if the data entered is a letter and if not true returns false. if(document.merch.pcode.value.length <3) { alert("The postcode you have entered is not valid.") document.merch.pcode.value.focus() return false } //checks to see if the data has less than 3 characters and alerts the user if true. numericExpression = /^[0-9+\ ]+$/; if(document.merch.pcode.value.match(numericExpression)){ }else{ alert("You can only enter numbers in the postcode field") document.merch.pcode.value.focus() return false; } //checks to see if the data entered is a number and if not true returns false. if(document.merch.pcode.value.indexOf(" ")!=-1) { alert("The postcode you have entered is not valid.") document.merch.pcode.value.focus() return false } //checks to see if the data has a space and alerts the user if true. if (document.merch.state.value == "Select") { alert("Please select your state") document.merch.state.focus() return true } //checks to see if the data has been selected and alerts the user if false. paymentmeth(); openNewWin(); subWrite(); //calling the two functions } function paymentmeth() { for (i = 0; i < document.merch.payway.length; i++){ if (document.merch.payway[i].checked == true){ //a loop that is used to determine the paymethod and checks to see if data has been entered method = document.merch.payway[i].value //declares method }//ends IF }//ends //error control for nothing checked if (method == false) { //if method equals nothing show alert // this fails to validate alert("You forgot to select Pay Method.") } //document.merch.paytype.value = method; } function emailForm(){ sendemail = "micha3l26@hotmail.com"; subject = "Order Details"; message = ("Clients Information firstname is "+firname +" Surname is "+ surname +" PhoneNumber is "+ phonenumber +" EmailAddress is "+ emailaddress +" Street Name and Number is "+ streetnamenumber +" Suburb is "+ yoursuburb +" Postcode is "+ postcode +" State is "+ yourstate +" Payment Method is "+ method +" Total Payment is "+ Cost); mailto_link = ('mailto:'+sendemail+'?subject='+subject+'&body='+message); win = window.open(mailto_link,"emailWindow"); if (win && win.open &&!win.closed)win.close(); } //ends function function openNewWin() { var newWin; newWin = window.open("","newWin","status,height=600,width=600") //opens the window and sets it 600px by 600px } //open new window function subWrite() { if (newWin.closed) { makeNewWin() } newWin.focus() var image = "<img src=quote.jpg>"; //declares variable image as the banner jpg newWin.document.write(image) //document writes the variable image newWin.document.write("<br/>"); newWin.document.write("<br/>"); newWin.document.write("Your FirstName is "+firname); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your Surname is "+surname); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your PhoneNumber is "+phonenumber); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your EmailAddress is "+emailaddress); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your Street Name and Number is "+streetnamenumber); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your Suburb is "+yoursuburb); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your Postcode is "+postcode); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your State is "+yourstate); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your Pay Method is "+method); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("Your total payment is "+Cost); //writes the variable into the new document newWin.document.write("<br/>"); newWin.document.write("<input type="button" onClick="emailForm()" value="Send Email"/> "); //("<div style="border:2px solid black;padding:10px;"> //Please <a href="#" onclick="emailForm();">Email Support</a> //</div>"); //a document write to input a button, with an onclick function to mailto a email address var newContent = "</BODY></HTML>" newWin.document.write(newContent) newWin.document.close() // close layout stream } //calling the two functions //the send email button does not work. function tally() { //the function that calculates the prices of tshirts Cost =0; //sets the cost at 0 if (document.merch.tshirt1.checked) { Cost = Cost + parseInt(document.merch.tshirt1.value); } //cost which is 0 + the tshirt value equals the price of tshirt 1 //repeated 8 times if (document.merch.tshirt2.checked) { Cost = Cost + parseInt(document.merch.tshirt2.value); } if (document.merch.tshirt3.checked) { Cost = Cost + parseInt(document.merch.tshirt3.value); } if (document.merch.tshirt4.checked) { Cost = Cost + parseInt(document.merch.tshirt4.value); } if (document.merch.tshirt5.checked) { Cost = Cost + parseInt(document.merch.tshirt5.value); } if (document.merch.tshirt6.checked) { Cost = Cost + parseInt(document.merch.tshirt6.value); } if (document.merch.tshirt7.checked) { Cost = Cost + parseInt(document.merch.tshirt7.value); } if (document.merch.tshirt8.checked) { Cost = Cost + parseInt(document.merch.tshirt8.value); } document.merch.Total.value = "$"+Cost; } </script> Code: <style type="text/css"> <!-- .style1 { font-family: Century Gothic; color: #FFFFFF; } .style3 {font-family: Century Gothic; color: #FFFFFF; font-size: 24px; } .style5 {color: #000000} --> <!--Declaring the different styles of text !--> </style></HEAD> <BODY BGCOLOR="BLACK"> <div align="center"><img src="mymerchbanner.jpg" width="787" height="158"> <!The placement of the main banner> </div> <HR> <FORM NAME="merch" onSubmit="main()"> <!declaring the forms name and onsubmit run the function main> <table width="368" border="1" bordercolor="#000000" bgcolor="#000000"> <tr> <td width="187" height="40"><span class="style3">First Name: </span></td> <td width="165"><input type="text" name="firstname" id="firstname"></td> </tr> <!firstname textboxes> <tr> <td height="45"><span class="style3">Last Name: </span></td> <td><input type="text" name="lastname" id="lastname"></td> </tr> <!lastname textboxes> <tr> <td height="44"><span class="style3">Phone Number:</span></td> <td><input type="text" name="phonenum" id="phonenum"></td> </tr> <!phonenumber textboxes> <tr> <td height="43"><span class="style3">Email Address:</span></td> <td><input type="text" name="emailadd" id="emailadd"></td> </tr> <!emailaddress textboxes> <tr> <td><span class="style3">Street Name and Number:</span></td> <td><input type="text" name="stnamenum" id="stnamenum"></td> </tr> <!streetnameandnumber textboxes> <tr> <td height="43"><span class="style3">Suburb:</span></td> <td><input type="text" name="suburb" id="suburb"></td> </tr> <!suburb textboxes> <tr> <td height="42"><span class="style3">Postcode:</span></td> <td><input type="text" name="pcode" id="pcode"></td> </tr> <!postcode textboxes> <tr> <td height="42"><span class="style3">State:</span></td> <td> <select name="state" id="state"> <option value="SA">SA</option> <option value="TAS">TAS</option> <option value="QLD">QLD</option> <option value="VIC">VIC</option> <option value="NSW">NSW</option> <option value="ACT">ACT</option> <option value="NT">NT</option> <option value="WA">WA</option> <option value="Select" selected>Click to select</option> </select> </td> </tr> <!state selection> </table> <p> </p> <p class="style3">What Would you Like Today? </p> <table width="684" border="0" bordercolor="#000000" bgcolor="#000000"> <tr> <td width="79" class="style1">0001</td> <td width="79">2<span class="style1">0002</span></td> <td width="79"><span class="style1">0003</span></td> <td width="79"><span class="style1">0004</span></td> <td width="79"><span class="style1">0005</span></td> <td width="79"><span class="style1">0006</span></td> <td width="79"><span class="style1">0007</span></td> <td width="79"><span class="style1">0008</span></td> </tr> <tr> <td><img src="1.png" width="100" height="100"></td> <td><img src="2.png" width="100" height="100"></td> <td><img src="3.png" width="100" height="100"></td> <td><img src="4.png" width="100" height="100"></td> <td><img src="6.png" width="100" height="100"></td> <td><img src="8.png" width="100" height="100"></td> <td><img src="9.png" width="100" height="100"></td> <td><img src="10.png" width="100" height="100"></td> </tr> <!tshirt images for the 8 shirts> <tr> <td><input type="checkbox" name="tshirt1" Value="15" onClick="tally()"> ></td> <td><input type="checkbox" name="tshirt2" Value="15" onClick="tally()"> ></td> <td><input type="checkbox" name="tshirt3" Value="15" onClick="tally()"> > </td> <td><input type="checkbox" name="tshirt4" Value="30" onClick="tally()"> > </td> <td><input type="checkbox" name="tshirt5" Value="30" onClick="tally()"> > </td> <td><input type="checkbox" name="tshirt6" Value="15" onClick="tally()"> > </td> <td><input type="checkbox" name="tshirt7" Value="15" onClick="tally()"> > </td> <td><input type="checkbox" name="tshirt8" Value="15" onClick="tally()"> > </td> </tr> <!8 checkboxes with diffent values that are used to add up the prices and onclick run function tally> <tr> <td class="style1">$15</td> <td class="style1">$15</td> <td class="style1">$15</td> <td class="style1">$30</td> <td class="style1">$30</td> <td class="style1">$15</td> <td class="style1">$15</td> <td class="style1">$15</td> </tr> <!text for prices> </table> <td> Total <INPUT TYPE="text" NAME="Total" value="0" size="7"></td> <p class="style3">How Will you Like to Pay? </p> <table width="268" border="0" align="center" bordercolor="#000000"> <tr> <td width="196" class="style3">Cash on Delivery </td> <td width="56"><input name="payway" type="radio" value="Cash"onClick="paymentmeth()"></td> </tr> <!radio button with different values and onclick run paymentmeth> <tr> <td class="style3">Bank Deposit </td> <td><input name="payway" type="radio" value="Bank Deposit"onClick="paymentmeth()"></td> </tr> <tr> <td class="style3">Paypal</td> <td><p> <input name="payway" type="radio" value="Paypal"onClick="paymentmeth()"> <label></label> </p></td> </tr> </table> <p> </p> <p align="center" class="style3"> <INPUT TYPE="SUBMIT" VALUE="Show Invoice" onSubmit="main()"> <!submit button that runs function> <span class="style5"> </span> <input type="RESET" /> <!reset button that runs function> <span class="style5"> </span> </p> </FORM> </BODY> </HTML> Hey, I have a couple of forms which use JS validation and if the validation checks out the forms action is a new php page which sends the form (see code below). It all works fine but occasionally blank emails come through. After researching some people say I shouldn't use client side validation. Is there an easier way by tweaking the code I have rather than changing it all completely? Code: <script language="php"> $email = $HTTP_POST_VARS[email]; $mailto = "info@xxxxxxxx.com"; $mailsubj = "mail form"; $mailhead = "From: $Email\n\n"; reset ($HTTP_POST_VARS); $mailbody = "mail:\n\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; } if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); } </script> thanks for any help, E Howdy all! Hope Thursday's treatin everybody all right. Way back in the day I did some old school HTML....but after many years not touching a web page I've kind of been thrown straight into the fire with some "wish list" items I'm trying to figure out. I've done plenty of searches and somewhat have an understanding of some of the basics of what I need to do...but I'm not the least bit comfortable with Javascript (I'm just assuming that this the language most applicable to what I'm looking for - please tell me if I'm wrong!) and after the experience of my one day crash course with PHP I knew I needed to turn to some experts. Okay I have a rather large web (about 150 pages) of historical transcriptions created with XHTML (with PHP headers and footers embedded). Generally speaking, I don't much like web pages that have right-click disabled and various other protections in place.....but I'm also the sort to obsessively cite my source material and give proper credits....as a researcher who's hard work has been plagiarized and passed off as the fruits of someone else's labor, I wholly understand why many are inclined to put such walls up. I am aware that there are workarounds to get through almost all such "blocks" - disabling scripts, etc. - and that they serve more as pop-up thought provokers and deterrents to the majority than true security from someone hell-bent on copying the material. Further, I wouldn't want to block an honest researcher from copying/pasting/etc. So this is what I'd wondering... Is it possible to disable right-clicking in a manner that when someone tried, a dialogue/input box with a personal message and request for their name and email address would pop up which (1) would continue to disable right-clicking if "cancel" was chosen rather than the information submitted, (2) would enable right-clicking after they submitted this information - and would keep it enabled until they left the site, and (3) would email me the information. Again, I do know most any solution would be "crackable" and not even show its head to some users...but I think its still worth taking the time to implement...even if it only serves as a thought provoker and appeals to one's conscience. Thanks in advance for any and all help! Brittanie Hi, I hope someone can help me. I'll be honest and say I don't know much about javascript, but am fairly comfortable in html. I am building a website that will have multiple image swaps on multiple pages. I am building this in wordpress, and I'm guessing that means my approach will be different than if I wasn't using wordpress. Here's how one page would work: There are 10 images shown. 1,2,3,4,5,6,7,8,9,10. When number 1 is clicked on, I want a new image - 1a. When 2 is clicked on, 2a. So there are 20 different images in all on a given page. Also, I want the user to be able to click on the image again to restore the original image. I would prefer onclick to onmouseover. There will be literally dozens of pages like this on the site, managed by wordpress, so hundreds of images to swap. Basically the first image is a question - the second image is the answer. Is this possible? I have a quick question with multiple array and random numbers. If i generate my random numbers in one array, how would i take a selection of those numbers and put them in another array? Ex: array 1: 25, 34, 38, 40, 22, 49 want to move numbers between 30 and 50 to another array. array 2: 34, 38, 40, 49 is it as simple as for loops and if statements setting the conditions? do i use a sorting method? (selection? bubble?) any help would be appreciated. here is my issue... i have an object and i need to call two functions. i need the onclick="something" to call a server side function and then i need another onclick="something" to call a javascript funtion... the problem is you can only have one "onclick" (similar to having one "class")... how can I set up an onclick that will call both my serverside function and my javascript function... I realize this is not specifically serverside section of forum, so pretend I am asking how to call two separate javascript functions with different names the item in question is here Code: <asp:Button ID="btn_gen1" runat="server" Text="InterventionCentral" class="show" onclick="btn_gen1_Click" onclick="autohide" onmouseover="details_visible(1)" onmouseout="details_hidden(1)" /> just showing this to clarify that javascript does work with the asp and my mouse functions are working fine... my asp onclick works as well.. i can remove the asp and leave the js and it will work, but then all the stuff i do server side for the onclick goes away is this able to be done? this is for dev testing and i will eventually run into the same problem of needing to call two separate javascipt functions via onmouseover and also onmouseout Ok, I have no idea how to really even explain what's been asked of me, but it's seems to me that this could be a bit beyond my knowledge. We're creating an alternate reality game which starts with a series of questions that people can choose from two answers. The answers will determine which path the person will travel. They'll be given a password at the end of the series of questions. There are three possible paths, which means three possible passwords given. On the same page, beneath the questions would be a text box with a "submit" button. The password they are given would be typed in there, and then they'd proceed to the proper page. This keeps from people being able to "skip" the questions portion. What they'd proceed to next is a video which is currently being made for our event, which has hidden puzzles and clues in it to find the next password. Rinse and repeat... My problem? How the heck do I make that box and submit button and password all work together when I have more than one password? Even more so, how do I make the password/submit button direct someone to the correct URL (without revealing the URL, and also prevents anyone from copying the URL and sharing it to bypass the password request)? For example: Questions are complete and the password "invention" is given. The person types in the word invention and presses submit. It directs the to www.url.com/game1 automatically. While someone else will come in, answer the questions, and the password "intelligence" would be given. That person types in the word intelligence and presses submit into the same box, using the same button that the person who typed in the word invention typed in. But this person would instead be directed to www.url.com/game2 If either person shared the link they were directed to, then it'd prompt people to put in a password before letting them in. How in the darn world do I make this happen?? LOL! Thanks in advance for any time, advice, or tutorials provided! ---------------------------------------- Added later.... I might need to go ahead and ask this as well.. since it got me to thinking.. How would I go about hiding the URL as well. I'm only interested in doing it for the game side of the site to keep from people sharing that URL and stripping the "fun" away from the game. Hopefully it is something simple? I'm fairly new at coding. My knowledge is no where as vast as I see many others here are. So if you should decide to have the patience to assist me, please be specific in steps like you are describing this to your kid who has no idea what you're talking about. I hate to present it that way, but I don't want to annoy anyone by stating I don't understand. Im having problems with this code working as it should. the top banner is supposed to cycle the second banner is supposed to be random the 3rd is a slide show that is supposed to work in order Everything works in random order. Any help would be appreciated. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>HTML and JavaScript</title> <script type="text/javascript"> var imgArray=new Array(4); imgArray[0]= new Image; imgArray[0].src="lions3.gif"; imgArray[1]= new Image; imgArray[1].src="tigers3.gif"; imgArray[2]= new Image; imgArray[2].src="bears3.gif"; imgArray[3]= new Image; imgArray[3].src="ohmy3.gif"; var index=0 function startup() { cycle(); select(); return } </script> <script type="text/javascript"> function cycle() { document.banner.src= imgArray[index].src; index++; if (index==4) { index=0; } setTimeout("cycle()",1000); return; } </script> <script type="text/javascript"> function select() { index=Math.floor(Math.random()*4); document.banner1.src=imgArray[index].src; setTimeout("select()",2000); return; } </script> <script type="text/javascript"> function doBack() { if (index>0) { index--; document.slideshow.src=imgArray[index].src; } return; } function doNext() { if (index<3) { index++; document.slideshow.src=imgArray[index].src; } return; } </script> </head> <body onload="startup()";> <center><img name="banner" src="lions3.gif" id="banner"> <div align="center"><img name="banner1" src="tigers3.gif" id="banner1"></div> </center> <div align="center"> <h2>My JavaScript Slideshow</h2> <p><img name="slideshow" src="lions3.gif"></p> <p><a href="javascript:doBack()">Back</a> * * * * <a href="javascript:doNext()">Next</a></p> </div> </body> </html> Hi all - I'm having difficulty with the processing of 3 forms on my web page. We'll call my 3 forms A, B, and C. By default my page shows form A. The other 2 forms I have hidden via display:none My issue is when I have form B or C showing. Once I hit submit, say within form B for example, I'd like this form to remain for future entries/submital of data. However, instead what happens is form A appears. How do I get form B to remain, allowing for a user to submit multiple entries of data without going back to form A? Here's my code for form 'B' <div id="branches_info" style=" <?php echo $display_branches; ?> "> form method="post" action="annual_report_main.php" onsubmit="return validateBranches(this);"> <fieldset> <p><strong>Branch Location</strong></p><br /> <label for="branch_address" class="long">Street Address:</label> <input maxlength="50" type="text" name="branch_address" id="branch_address" value="<?php echo htmlentities($_POST['branch_address']);?>" /><br /> <div class="cleaner"></div> <label for="branch_city" class="long">City:</label> <input maxlength="20" type="text" name="branch_city" id="branch_city" value="<?php echo htmlentities($_POST['branch_city']);?>" /><br /> <div class="cleaner"></div> <label for="branch_state" class="long">State:</label> <input maxlength="2" type="text" name="branch_state" id="branch_state" value="<?php echo htmlentities($_POST['branch_state']);?>" /><br /> <div class="cleaner"></div> <label for="branch_zip" class="long">Zip Code:</label> <input maxlength="10" type="text" name="branch_zip" id="branch_zip" value="<?php echo htmlentities($_POST['branch_zip']);?>" /><br /> <div class="cleaner"></div> <div class="content_onecolumn"> <input type="submit" name="Branches" value="Submit to Database" class="inputSubmit" /> </div> <div class="content_onecolumn"> <input type="button" name="Finished" value="Finished" class="inputSubmit" onclick="window.open('https://www.dca.ca.gov/webapps/bppe/thankyou.php');return false" /> </div> </fieldset> </form> </div> FYI: THIS IS NOT HOMEWORK! Hi all, I am trying to make an all-in-one function that can use local storage and provide 4 functions: (1) read data (2) write data (3) erase specific data (4) erase all data Here's the code block I have (with alerts in place of the local storage code for debugging): Code: var storage = function (name, value) { if (name) { if (value === null) { return alert('erase'); } else { if (value != null) { return alert('write'); } else { return alert('read'); } } } else { return alert('nuke'); } }; I want to use it like this: storage(); - erases ('nukes') everything storage('abc'); - reads data stored as 'abc' storage('abc', 'newvalue'); - stores 'newvalue' as 'abc' storage('abc', null); - erases data stored as 'abc' only It seems to work, but I have a funny feeling about trusting the difference between "==" and "===" to make it work. Am I wrong? Is there a real difference between == and === and am I doing this correctly? Thanks! -- Roger Hi folks. I am new to javascript so please go easy on me if this is a silly request Basically I have a table generated by a php script with a dynamic number of rows and columns. Here is a sample of the output from this script: Code: <tr> <td style='width:60px'><a href='index.php?inc_id=30' onclick='return confirmDelete(this)'>Remove</a></td> <td style='text-align:center'>test</td> <td ><input type='text' name='0inccol0' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='0inccol1' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='0inccol2' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='0inccol3' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='0inccol4' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='0inccol5' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='0inccol6' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='0inccol7' value='$432.00' style='text-align:center; background-color:#cccccc'/></td> </tr> <tr> <td style='width:60px'><a href='index.php?inc_id=31' onclick='return confirmDelete(this)'>Remove</a></td> <td style='text-align:center'>test2</td> <td ><input type='text' name='1inccol0' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='1inccol1' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='1inccol2' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='1inccol3' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='1inccol4' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='1inccol5' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='1inccol6' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='1inccol7' value='$213.00' style='text-align:center; background-color:#cccccc'/></td> </tr> <tr> <td style='width:60px'><a href='index.php?inc_id=32' onclick='return confirmDelete(this)'>Remove</a></td> <td style='text-align:center'>test3</td> <td ><input type='text' name='2inccol0' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='2inccol1' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='2inccol2' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='2inccol3' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='2inccol4' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='2inccol5' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='2inccol6' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> <td ><input type='text' name='2inccol7' value='$65.00' style='text-align:center; background-color:#cccccc'/></td> </tr> What I want to do is create a row of 'totals' fields at the bottom of this table that will sum the fields in the column above. Looking at the naming convention above, the first number is the row, the number at the end is the column so I will want to sum all of the input values with a name ending in 0 in the first 'total' field, all the input values with names ending in 1 in the next and so on. The number of rows and columns is dynamic based on the users selections prior to buiding the table. The reason I am using input fields is that I would also like an event (onChange/onBlur?) that will update the totals fields if a user manually changes the value in one of the inputs. Any advice on this will be appreciated! I'm making a website, and my aim is to have a terminal like interface. I am encountering a problem with startup text. I cannot get it to work right with the following... function title() { document.getElementById("prompts").innerHTML = "OS v0.1"+ setTimeout("<br />> Loading...",2500)+ setTimeout("<br />> FATAL ERROR!",12500)+ setTimeout("<br />> Please enter command.",13500); } However I get undefined for the settimeouts. I don't know how to work with timeouts. I have a simple blinking image. but I'm not sure how to set multiple timeouts? Basically I want the image to blink to another one for 400, then return to the first image for 5000 here's the basic starting point I have: Code: <script type="text/javascript"> var img_off = new Image(); img_off.src = 'images/blink.png'; var img_on = new Image(); img_on.src = 'images/orho2.png'; function blink() { var e = document.getElementById("blinking_orho"); e.src = (e.src == img_on.src) ? img_off.src : img_on.src; setTimeout("blink();", 5000,); } </script> Hello everyone, I have a problem in redirecting into multiple pages based on if statement result. I have used 3 redirects, only the first one works "redirect1" when I chose any other option.. it always redirects me to the redirect1 page! Please I need your help experts ! The whole code is attached. Hello! I'm trying to make a website that from one link, opens multiple windows. It is for a design project (I'm still at uni). So far I have mustered just the one window. Here is the website: http://popmeup.org/ The idea is that you get bombarded with lots of nice quotes. I don't know my arse from my Javascript - but has anyone got any advice? plz i want to know how to make the effects that exists on this link in the upper part : http://www.masrawy.com/new/ 1-) changing color when pressing on the color 2-) changing font (+) to increase it (-) to decrease it (N) to set it to the normal style 3-) decrease and increase the width of the page (from كبر حجم الصفحة or صغر حجم الصفحة ) can anyone help me in doing this task????? hi its me again. i was using the data that I pulled out from my db and then provide a push button weather to lock it or not but the problem is, the js code doesn't mouse over on the next button, here's the js code Code: var once = true; function asktolock(){ if(once){ document.getElementById('locker').value = "Lock Me ?"; } } function lockme(){ document.getElementById('locker').value = "Locked"; once = false; } and here's my html with php/js code PHP Code: <?php foreach($task->result() as $row): ?> <tr> <td><?php echo $row->title; ?></td> <td><input type="button" id="locker" value="unlocked" onmouseover="asktolock()" onclick="lockme()" /></td> <td><?php echo $row->assign_to; ?></td> </tr> <?php endforeach; ?> if I will put an "onmouseout" and feed it with a function like this Code: function passby(){ document.getElementById('locker').value = "unlock"; } the clicking function won't work anymore, what's the best thing to do? |