JavaScript - Using The Result Of A Function In Next Funtion
Hello all,
I am new to these forms, and new to Javascript as well. I have gone through some lessons, and have been trying to write a simple script on my own. Here is what I am trying to do: I am calculating a volume, and want to display the result of that calculation. I then want to take the result and multiply it by 2 and display that as well. Here is what I have so far: Code: function volume (l, w, h) { return l * w * h; } console.log("Volume = " + volume (2, 2, 2)); So far so good... but I cant figure out how to then take that result that was displayed in the console and save it as a variable (if that would be the correct way to do it) so that I can modify the result by 2. I have tried several things with no luck. How can I save the result of a function or pass it to another function? Thanks in advance! Similar TutorialsI will tell you now that I am not a javascript programmer and this is a very basic question. Please don't flame. I have been writing a web site and have found 2 functions that work and do what I want them to do, but I want to combine them. The first function will grab the window size.(it actually prints it out to the screen and I know how to get that to stop by taking out the last 2 lines) What I want to do with the results from the function alertSize() is exactly what the function res() does though. I want it to take the window size and jump to the appropriate web directory. What I don't know is if I can write that all as one function or if I have to pass the results of function alertSize() to function res(). Or how to do it for that matter, I don't even know what this is called in programming lingo. I am not asking for an answer here I would just like someone to point me in the right direction that I may learn a little more about what it is I want to do so I can get this to work. Giving me a search term would be a BIG help. Here is the first function. Code: // <script language="JavaScript"> //--> function alertSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } window.alert( 'width = ' + myWidth ); window.alert( 'height = ' + myHeight ); } // </script> //--> and the second function. Code: // <script language="JavaScript"> //--> function res() { alert('Screen Resolution Is '+screen.width+' by '+screen.height); } if ((screen.width>=1280) && (screen.height>=1024)) { window.location="/12/index.html"; } else if ((screen.width>=1024) && (screen.height>=768)) { window.location="/10/index.html"; } else if ((screen.width>=800) && (screen.height>=600)) { window.location="lowres1.html"; } else if ((screen.width>=640) && (screen.height>=480)) { window.location="lowres2.html"; } else { window.location="lowres3.html"; } // </script> //--> Can anyonle pls explain me why the return function is not returning the result as intended? I appreciate you help OUTPUT ====== Student : Doe,John eMail : johndoe@gmail.com Course ID : COIN-070B.01 -------------------------------- function task() { var title = ["Assignment1", "Assignment2", "Assignment3", "Assignment4", "Assignment5", "Mid Term", "Finals"]; var points = [30, 30, 28, 27, 29, 41, 45]; for (var i = 0; i < points.length; i++) { titlePoints += title[i] + (" : " + points[i] + "\n"); } return titlePoints; } Code: <head> <title>Variable - Examples 1</title> <script type="text/javascript"> function Student(firstName, lastName, email,courseID){ this.firstName = firstName; this.lastName = lastName; this.email = email; this.courseID = courseID; this.assignments = task; } Student.prototype = { constructor : Student, toString : studentInfo }; function task(){ var title = ["Assignment1","Assignment2","Assignment3","Assignment4","Assignment5","Mid Term", "Finals"] var points = [30, 30, 28, 27, 29,41,45]; var titlePoints = ""; for (var i=0; i < points.length; i++){ titlePoints += title[i] + " : " + points[i] + "\n"; } return titlePoints; } function studentInfo(){ return "Student : " + this.lastName + "," + this.firstName + "<br>"+ "eMail : " + this.email + "<br>" + "Course ID : " + this.courseID + "<br>" + "--------------------------------" + "<br>" + this.assignments; } var student = new Student("John", "Doe", "johndoe@gmail.com","COIN-070B.01"); </script> </head> <body> <script type="text/javascript"> document.writeln(student.toString()); </script> </body> </html> Hello! I am working on creating a basic calorie calculator with Javascript and my code is not showing the results after the user makes their selections. I've created a simple function to obtain the user's weight, activity and duration info but when I use the GetElementById to retrieve the result, it does not show up. Any help would be much appreciated to make this work. Thanks. Code: <head> <script type="text/javascript"> var myActivity = new Array(); myActivity[100] = "6.670"; myActivity[200] = "3.811"; myActivity[300] = "3.343"; myActivity[400] = "3.343"; myActivity[500] = "3.343"; myActivity[600] = "4.765"; myActivity[700] = "4.765" function CalorieBurner() { //user prompt var caloriesBurned; var myForm = document.form; //processing var caloriesBurned = (myForm.duration[formElement.value] * (myActivity[formElement.value] * 3.5 * myForm.weight[formElement.value])/200); FormElement = myForm.activity[myForm.activity.selectedIndex]; document.getElementById("caloriesBurned").innerHTML = "You will burn " + caloriesBurned + "calories doing " + myForm.duration[formElement.value] + "minutes of " + FormElement.text; } </script> </head> <body> <form name="form"> Enter your weight: <input type="text" name="weight" /> <br /><br /> Select an activity: <br /> <select name="activity"> <option value="100"> Backpacking, Hiking with pack </option> <option value="200"> Bagging grass, leaves </option> <option value="300"> Bathing dog </option> <option value="400"> Carpentry, general</option> <option value="500"> Carrying infant, level ground </option> <option value="600"> Carrying infant, upstairs </option> <option value="700"> Children's games, hopscotch... </option> </select> <br /><br /><br /> Enter the duration of your activity (in minutes): <input type="text" name="duration" /> </form> <br /><br /><br /> <input type="button" value="Results" name="btnUpdate" onClick="CalorieBurner()"/> <br /><br /><br /> <div id="caloriesBurned"></div> </body> </html> First post - spent the whole afternoon trying to figure it out and have hit a wall. I'm trying to check a database of lotto numbers against 3 different values and have gotten it that to work. What I need is to give a feedback message if no match is found once the submit button is clicked. Code: function winCheck() { var grandPrize = $('#grandPrize').val(); var otherPrize = $('#otherPrize').val(); var addPrize = $('#addPrize').val(); var resultrange = $('#resultrange').val(); db.transaction( function(transaction) { transaction.executeSql( 'SELECT * FROM entries WHERE daterange = ? ORDER BY lottonum;', [resultrange], function lottoCompare(transaction, result){ for (var i=0; i < result.rows.length; i++) { var row = result.rows.item(i); rowData = [row.lottonum]; rowStr = rowData.toString(); //the if else statements should go here. if (rowStr == grandPrize){ alert('The lotto number ' + grandPrize + ' is a jackpot winner'); } if (rowStr.slice(-7) == otherPrize.slice(-7)){ alert('The lotto number ' + rowStr + ' is a winner of $40,000'); } if (rowStr.slice(-6) == otherPrize.slice(-6)){ alert('The lotto number ' + rowStr + ' is a winner of $10,000'); } if (rowStr.slice(-5) == otherPrize.slice(-5)){ alert('The lotto number ' + rowStr + ' is a winner of $4,000'); } if (rowStr.slice(-4) == otherPrize.slice(-4)){ alert('The lotto number ' + rowStr + ' is a winner of $1,000'); } if (rowStr.slice(-3) == otherPrize.slice(-3)){ alert('The lotto number ' + rowStr + ' is a winner of $200'); } if (rowStr.slice(-3) == addPrize){ alert('The lotto number ' + rowStr + ' is a winner of $200'); } } }, errorHandler ); } ); return false; } Any help is appreciated I have entered the following in a file named welcome.htm when the form is submitted the Test! Alert comes up but the alert fields indicating the fields are empty do not appear. Please let me know if you can see why. Thanks Code: <html> <head> <script type="text/javascript"> alert('Test!'); function submitform() { alert('Test!'); alert('In fname is '+document.form.fname.value); if (document.form.fname.value == ""){ alert('The fnamefield is empty!'); return false; } if (document.form.age.value == ""){ alert('The fnamefield is empty!'); return false; } return true; } </script> </head> <body> <form id="myform" action="welcome.php" method="post" onSubmit="return submitform()" > Name: <input type="text" name="fname" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html> PHP Code: <script type="text/javascript"><!--//--><![CDATA[//><!-- sfHover = function() { var sfEls = document.getElementById("nav").getElementByClass("subMenuWrapper"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" sfhover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); //--><!]]></script> Im trying to get the sub navigation to work in ie 6 but can get it working.. can anybody tell me what the above funtion does and how i might be able to apply it to my code... the navigation i have so far is on http://www.corkdesigns.ie/ep3/testing.html Hope someone can help or is the a simple hack i can use for ie 6 for this navigation http://www.corkdesigns.ie/ep3/navigation1.html Thanks Hello everyone, i am having a few problems with my form and i was hoping someone can help me understand what i am doing wrong. I'm new to java and scripting for forms. Usually i use Simfatic Forms to build my forms but this form requires special coding and work. I'm build a 5 table form with a dynamically add and remove function that will allow the user to add more Rows to the form. What i would like the add function to do is allow my users to pick from a Dropdown menu how many rows they would like to add to the form from 1,5,10,15,20,25 rows. I have gotten the form to allow the add function of one row only but i cant get the add function to allow the select from list. when the row repeats it wont repeat the datepicker to a workable map or the number system from 5+ in table ren5 i have the page up on my site for testing purposes so you can see what is going on. Another issue im having is when i submit the form to my formtools it takes all the input info and puts it in one line in the datebase. What im trying to do is have each table submit to its own row in the datebase. What im looking for is help understanding what i need to do to make this work. I have been reading a lot of tutorials and have been searching a lot of help sites but everything i have read and tried so far will not work for what im trying to do. I really need help getting this to work in the next couple of days. Here is the link to the page on my server so you can see what is going on.http://www.poweronlydispatch.com/FastPostLoad.html Any help would be very helpful. Thank you all in-advance for your help and understanding off my problem. Here is the first part of the code Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css"> <SCRIPT language="javascript"> function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var colCount = table.rows[0].cells.length; for(var i=0; i<colCount; i++) { var newcell = row.insertCell(i); newcell.innerHTML = table.rows[0].cells[i].innerHTML; //alert(newcell.childNodes); switch(newcell.childNodes[0].type) { case "text": newcell.childNodes[0].value = ""; break; case "checkbox": newcell.childNodes[0].checked = false; break; case "select-one": newcell.childNodes[0].selectedIndex = 0; break; } } } function deleteRow(tableID) { try { var table = document.getElementById(tableID); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++) { var row = table.rows[i]; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox && true == chkbox.checked) { if(rowCount <= 1) { alert("Cannot delete all the rows."); break; } table.deleteRow(i); rowCount--; i--; } } }catch(e) { alert(e); } } </SCRIPT> <script src="development-bundle/jquery-1.6.2.js"></script> <script src="development-bundle/ui/jquery.ui.core.js"></script> <script src="development-bundle/ui/jquery.ui.widget.js"></script> <script src="development-bundle/ui/jquery.ui.datepicker.js"></script> <link rel="stylesheet" href="development-bundle/demos/demos.css"> <script> $(function() { $( "#datepicker" ).datepicker({ showOn: "button", buttonImage: "development-bundle/demos/images/calendar.gif", buttonImageOnly: true }); $( "#datepicker1" ).datepicker({ showOn: "button", buttonImage: "development-bundle/demos/images/calendar.gif", buttonImageOnly: true }); $( "#datepicker2" ).datepicker({ showOn: "button", buttonImage: "development-bundle/demos/images/calendar.gif", buttonImageOnly: true }); $( "#datepicker3" ).datepicker({ showOn: "button", buttonImage: "development-bundle/demos/images/calendar.gif", buttonImageOnly: true }); $( "#datepicker4" ).datepicker({ showOn: "button", buttonImage: "development-bundle/demos/images/calendar.gif", buttonImageOnly: true }); $( "#datepicker5" ).datepicker({ showOn: "button", buttonImage: "development-bundle/demos/images/calendar.gif", buttonImageOnly: true }); }); </script> <title>Untitled Document</title> </head> <body> <form action="http://www.poweronlydispatch.com/transporters/process.php" method="post" id="FastPostLoad" name="FastPostLoad"> <input type="hidden" name="form_tools_initialize_form" value="1" /> <input type="hidden" name="form_tools_form_id" value="36" /> <table width="100%" cellspacing="0" id="info"> <tr> <th width="20"> </th> <th width="14"> </th> <th width="110">Pickup Date</th> <th width="140">Dispatch Number</th> <th width="120">Trailer Type</th> <th width="80">Pickup City</th> <th width="70">Pickup State</th> <th width="60">Pickup Zip </th> <th width="80">Delivery City</th> <th width="80">Delivery State</th> <th width="60">Delivery Zip</th> <th width="80">Pay Ammount</th> <th width="60">Weight</th> </tr> </table> <table id="ren" width="100%" cellspacing="0"> <tr> <td width="20"><INPUT type="checkbox" name="chk"/></td> <td width="16"> 1 </td> <td width="180"><input type="text" name="datepicker" id="datepicker" size="20"></td> <td width="123"><input name="DispatchNumber" type="text" id="DispatchNumber" size="20"></td> <td width="148"><input name="TrailerType" type="text" id="TrailerType" size="25"></td> <td width="91"><input name="PickupCity" type="text" id="PickupCity" size="15"></td> <td width="89"><select name="PickupState" id="PickupState" size="1"> <option value="AK">AK</option><option value="AL">AL</option><option value="AR">AR</option><option value="AZ">AZ</option><option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DC">DC</option><option value="DE">DE</option><option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option><option value="IA">IA</option><option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option><option value="KS">KS</option><option value="KY">KY</option><option value="LA">LA</option><option value="MA">MA</option><option value="MD">MD</option><option value="ME">ME</option><option value="MI">MI</option><option value="MN">MN</option><option value="MO">MO</option><option value="MS">MS</option><option value="MT">MT</option><option value="NC">NC</option><option value="ND">ND</option><option value="NE">NE</option><option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><option value="NV">NV</option><option value="NY">NY</option><option value="OH">OH</option><option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option><option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option><option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option><option value="VA">VA</option><option value="VT">VT</option><option value="WA">WA</option><option value="WI">WI</option><option value="WV">WV</option><option value="WY">WY</option></select></td> <td width="90"><input name="PickupZip" type="text" id="PickupZip" size="10"></td> <td width="86"><input name="DeliveryCity" type="text" id="DeliveryCity" size="15"></td> <td width="89"><select name="DeliveryState" id="DeliveryState" size="1"> <option value="AK">AK</option><option value="AL">AL</option><option value="AR">AR</option><option value="AZ">AZ</option><option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DC">DC</option><option value="DE">DE</option><option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option><option value="IA">IA</option><option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option><option value="KS">KS</option><option value="KY">KY</option><option value="LA">LA</option><option value="MA">MA</option><option value="MD">MD</option><option value="ME">ME</option><option value="MI">MI</option><option value="MN">MN</option><option value="MO">MO</option><option value="MS">MS</option><option value="MT">MT</option><option value="NC">NC</option><option value="ND">ND</option><option value="NE">NE</option><option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><option value="NV">NV</option><option value="NY">NY</option><option value="OH">OH</option><option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option><option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option><option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option><option value="VA">VA</option><option value="VT">VT</option><option value="WA">WA</option><option value="WI">WI</option><option value="WV">WV</option><option value="WY">WY</option></select></td> <td width="90"><input name="DeliveryZip" type="text" id="DeliveryZip" size="10"></td> <td width="88"><input name="PayAmount" type="text" id="PayAmount" size="10"></td> <td width="90"><input name="Weight" type="text" id="Weight" size="10"></td> </tr> </tbody> <tfoot> </tfoot> </table> Hi, My webpage can work normally in IE but not in Safari(e.g. when I clicked on some buttons like 'Delete' button, the page opened in Safari stays the same while it should delete the object chosen). When I tried debugging on Safari, after clicking the 'update' button, this message error appeared: "TypeError: Result of expression 'this.form.fireEvent' [undefined] is not a function". I believe this code makes the incompatability between the 2 browser: Code: function DeleteClick() { var frmSWO = document.getElementById("form"); var answer = confirm("Do you really want to delete?") if (answer != 0) { frmSWO.action = "/domsWeb/mtd/doms/web/operation/eDepotMNR/controller/manageWorkOrder/DeleteJobOrImage.do"; frmSWO.method = "post"; this.form.fireEvent('onsubmit'); frmSWO.submit(); } } Any suggest how should I amend the script for it to work on 2 browser concurrently? Thanks all! Hi there, i have a dynamic form that is populated via a sql query (WHERE $AVAILABLE_PRODUCT > 0) hence the javascript that is called onchange has dynamic field names. i used numbers. the for loop works fine: Code: var numberOfFields = document.order_form.elements.length; for (var i=1; i<numberOfFields-3; i=i+4) { if (document.order_form.elements[i].value > document.order_form[i+3].value) { alert(document.order_form.elements[i].value + ' > ' + document.order_form[i+3].value); } .... } Alert Box shows: 3 > 17 or similar (where 17 is the number of items on stock, and three the number of items ordered.) all other calculations with that form work fine. any idea? Good day to you all, I'm working on a form which would display the result in the same div that the form is. Here is my code so far: PHP Code: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <textarea name="html"></textarea><br /> <input type="submit" onclick="load('<?php echo $_SERVER['PHP_SELF']; ?>','page');"/><br /> </form> Preview:<br /> <?php if(isset($_POST['html'])) echo stripslashes($_POST['html']); ?> <script type="text/javascript"> function ahah(url, target) { document.getElementById(target).innerHTML = ' Fetching data...'; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req != undefined) { req.onreadystatechange = function() {ahahDone(url, target);}; req.open("GET", url, true); req.send(""); } } function ahahDone(url, target) { if (req.readyState == 4) { // only if req is "loaded" if (req.status == 200) { // only if "OK" document.getElementById(target).innerHTML = req.responseText; } else { document.getElementById(target).innerHTML=" Error:\n"+ req.status + "\n" +req.statusText; } } } function load(name, div) { ahah(name,div); return false; } </script> My problem is when I click on the button , the text in my text area don't show. Can somebody help me. Thanks! I am trying to set up a small legend type html. What I am trying to accomplish is to give the user a description depending on the abbv they pick from the drop down. This all works fine, however I now want to improve this to actually give them a link to a site if they want to research the description further. I can get it to work if I do document.write but I want the link to go into the text box. I also thought about making a button to the side that would probably need some sort of function to call each url. That may come down the road but the simpler way would be nice. I have a js called abbs there is actually two ways to do the drop downs but I am only concerned with adding links to the top one. On the CCVT option I have added a link but the only way I can get it to work is through document.write. Here is my JS code: Code: function findMEAN(){ var abb = document.listNAME.abbWRD.value; if (abb == "AEP"){ abbs = ("American Electric Power") ;} else if (abb == "A"){ abbs = ("AMP") ;} else if (abb == "AC"){ abbs = ("ALTERNATING CURRENT") ;} else if (abb == "ACI"){ abbs = ("AMERICAN CONCRETE INSTITUTE") ;} else if (abb == "ACB"){ abbs = ("AIR CIRCUIT BREAKER") ;} else if (abb == "AISC"){ abbs = ("AMERICAN INSTITUTE OF STEEL CONSTRUCTION") ;} else if (abb == "ANSI"){ abbs = ("AMERICAN NATIONAL STANDARDS INSTITUTE") ;} else if (abb == "ARO"){ abbs = ("AUTOMATIC RECLOSING OPERATION") ;} else if (abb == "ASCE"){ abbs = ("AMERICAN SOCIETY OF CIVIL ENGINEERS") ;} else if (abb == "ASTM"){ abbs = ("AMERICAN SOCIETY FOR TESTING AND MATERIAL") ;} else if (abb == "AUX"){ abbs = ("AUXILUARY") ;} else if (abb == "AWG"){ abbs = ("AMERICAN WIRE GAUGE") ;} else if (abb == "BCT"){ abbs = ("BUSHING CURRENT TRANSFORMER") ;} else if (abb == "BIL"){ abbs = ("BASIC INSULATION LEVEL") ;} else if (abb == "BOM"){ abbs = ("BILL OF MATERIAL") ;} else if (abb == "BPD"){ abbs = ("BUSHING POTENTIOAL DEVICE") ;} else if (abb == "BPLC"){ abbs = ("BROADBAND POWER LINE CARRIER") ;} else if (abb == "BT"){ abbs = ("BUS TIE") ;} else if (abb == "CAB"){ abbs = ("CABLE") ;} else if (abb == "CAT#"){ abbs = ("CATALOG NUMBER") ;} else if (abb == "CB"){ abbs = ("CIRCUIT BREAKER") ;} else if (abb == "CCVT"){ abbs = ("COUPLING CAPACITOR VOLTAGE TRANSFORMER") ; abbslnk = "<p>Link: " + abbs.link("http://www.abb.com/product/db0003db002618/c12573e7003302adc1256ffd001d1256.aspx") + "</p>";} else if (abb == "CS"){ abbs = ("CIRCUIT SWITCHER") ;} else if (abb == "CT"){ abbs = ("CURRENT TRANSFORMER") ;} else if (abb == "CVT"){ abbs = ("CAPACITOR VOLTAGE TRANSFORMER") ;} else if (abb == "DC"){ abbs = ("DIRECT CURRENT") ;} else if (abb == "DEB"){ abbs = ("DOUBLE END BREAK") ;} else if (abb == "DMS"){ abbs = ("DATA MANAGEMENT SYSTEM/DIGITAL METERING SYSTEM") ;} else if (abb == "FDN"){ abbs = ("FOUNDATION") ;} else if (abb == "FMP"){ abbs = ("FIELD MARKED PRINT") ;} else if (abb == "GIS"){ abbs = ("GAS INSULATED SYSTEM") ;} else if (abb == "GND,GRDG"){ abbs = ("GROUND(ING)") ;} else if (abb == "GOAB"){ abbs = ("GAS OPREATED AIR BREAK") ;} else if (abb == "GOS"){ abbs = ("GANG OPREATED SWITCH") ;} else if (abb == "IFC"){ abbs = ("ISSUE FOR CONSTRUCTION") ;} else if (abb == "KA"){ abbs = ("KILO AMP") ;} else if (abb == "KCM"){ abbs = ("KILO(1000) CIRCULAR-MILS") ;} else if (abb == "KV"){ abbs = ("KILOVOLT") ;} else if (abb == "KVAR"){ abbs = ("KILOVOLT-AMPERES REACTIVE") ;} else if (abb == "LTC"){ abbs = ("LOAD TAP CHANGER") ;} else if (abb == "MLSE"){ abbs = ("MOST LIMITING SIGNIFICANT ELEMENT") ;} else if (abb == "MOAB"){ abbs = ("MOTOR OPERATED AIR BREAK") ;} else if (abb == "MOD"){ abbs = ("MOTOR OPERATED DISCONNECT") ;} else if (abb == "MR"){ abbs = ("MATERIAL REQUEST") ;} else if (abb == "MVAR"){ abbs = ("MEGAVOLT AMPERE REACTIVE") ;} else if (abb == "N.C."){ abbs = ("NORMALLY CLOSED") ;} else if (abb == "N.O."){ abbs = ("NORMALLY OPEN") ;} else if (abb == "NEMA"){ abbs = ("NATIONAL ELECTRICAL MANUFACTURER\'S ASSOCIATION") ;} else if (abb == "OCB"){ abbs = ("OIL CIRCUIT BREAKER") ;} else if (abb == "OEC"){ abbs = ("OUTSOURCED ENGINEERING COMPANY") ;} else if (abb == "OLD"){ abbs = ("ONE LINE DIAGRAM") ;} else if (abb == "OSHA"){ abbs = ("OCCUPATIONAL SAFETY AND HEALTH ADMINISTRATION") ;} else if (abb == "P&C"){ abbs = ("PROTECTION & CONTROL") ;} else if (abb == "PCIS"){ abbs = ("PROTECTION AND CONTROL INFORMATION SYSTEM") ;} else if (abb == "PCSS"){ abbs = ("PROTECTION & CONTROL SUPPORT SERVICES") ;} else if (abb == "PED"){ abbs = ("PROTECTION EXECUTION DOCUMENT") ;} else if (abb == "POP"){ abbs = ("PHASE OVER PHASE") ;} else if (abb == "PRA"){ abbs = ("PROJECT ROUTING & APPROVAL") ;} else if (abb == "PT"){ abbs = ("POTENTIAL TRANSFORMER") ;} else if (abb == "RIM"){ abbs = ("RELAY INSTRUMENTATION & METERING") ;} else if (abb == "RMS"){ abbs = ("ROOT MEAN SQUARE") ;} else if (abb == "RPA"){ abbs = ("R(TU) POINT ASSIGNMENT") ;} else if (abb == "RTU"){ abbs = ("REMOTE TERMINAL UNIT") ;} else if (abb == "S/N"){ abbs = ("SERIAL NUMBER") ;} else if (abb == "SA"){ abbs = ("SURGE ARRESTOR") ;} else if (abb == "SCADA"){ abbs = ("SUPERVISORY CONTROL AND DATA ACQUISITION") ;} else if (abb == "XF"){ abbs = ("TRANSFORMER") ;} else if (abb == "WD"){ abbs = ("WIRING DIAGRAM") ;} else if (abb == "VCB"){ abbs = ("VACUUM CIRCUIT BREAKER") ;} else if (abb == "V"){ abbs = ("VOLT") ;} else if (abb == "TCR"){ abbs = ("TRANSMISSION CONSTRUCTION REPRESENTATIVE") ;} else if (abb == "SW"){ abbs = ("SWITCH") ;} else if (abb == "SOW"){ abbs = ("SCOPE OF WORK") ;} else if (abb == "SESS"){ abbs = ("STATION ENGINEERING SUPPORT SERVICES") ;} { var result=document.getElementById("resultbox"); result.value = abbslnk } Here is my HTML code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>ACRONYMS</title> <script type= "text/javascript" src="abbs.js"> </script> <style type="text/css" media="Screen"> fieldset { border: 5px solid #555555; padding: 20px; width:350px; word-wrap: normal; } </style> </head> <body> <fieldset style="width:410px; height: 250px"> <h2>DESCRIPTION BY ABBV</h2> <form name = "listNAME"> <select name="abbWRD"> <option value=A>A</option> <option value=AC>AC</option> <option value=ACB>ACB</option> <option value=ACI>ACI</option> <option value=AEP>AEP</option> <option value=AISC>AISC</option> <option value=ANSI>ANSI</option> <option value=ARO>ARO</option> <option value=ASCE>ASCE</option> <option value=ASTM>ASTM</option> <option value=AUX>AUX</option> <option value=AWG>AWG</option> <option value=BCT>BCT</option> <option value=BIL>BIL</option> <option value=BOM>BOM</option> <option value=BPD>BPD</option> <option value=BPLC>BPLC</option> <option value=BT>BT</option> <option value=CAB>CAB</option> <option value=CAT#>CAT#</option> <option value=CB>CB</option> <option value=CCVT>CCVT</option> <option value=CS>CS</option> <option value=CT>CT</option> <option value=CVT>CVT</option> <option value=DC>DC</option> <option value=DEB>DEB</option> <option value=DMS>DMS</option> <option value=FDN>FDN</option> <option value=FMP>FMP</option> <option value=GIS>GIS</option> <option value=GND,GRDG>GND,GRDG</option> <option value=GOAB>GOAB</option> <option value=GOS>GOS</option> <option value=IFC>IFC</option> <option value=KA>KA</option> <option value=KCM>KCM</option> <option value=KV>KV</option> <option value=KVAR>KVAR</option> <option value=LTC>LTC</option> <option value=MLSE>MLSE</option> <option value=MOAB>MOAB</option> <option value=MOD>MOD</option> <option value=MR>MR</option> <option value=MVAR>MVAR</option> <option value=N.C.>N.C.</option> <option value=N.O.>N.O.</option> <option value=NEMA>NEMA</option> <option value=OCB>OCB</option> <option value=OEC>OEC</option> <option value=OLD>OLD</option> <option value=OSHA>OSHA</option> <option value=P&C>P&C</option> <option value=PCIS>PCIS</option> <option value=PCSS>PCSS</option> <option value=PED>PED</option> <option value=POP>POP</option> <option value=PRA>PRA</option> <option value=PT>PT</option> <option value=RIM>RIM</option> <option value=RMS>RMS</option> <option value=RPA>RPA</option> <option value=RTU>RTU</option> <option value=S/N>S/N</option> <option value=SA>SA</option> <option value=SCADA>SCADA</option> <option value=SESS>SESS</option> <option value=SOW>SOW</option> <option value=SW>SW</option> <option value=TCR>TCR</option> <option value=V>V</option> <option value=VCB>VCB</option> <option value=WD>WD</option> <option value=XF>XF</option> </select> </form><br> <input value="Click for Description" onclick="findMEAN()" type="button"> </br></br> <input type="text" name="myresultbox" id="resultbox" style="width:400px; height:75px;"> </fieldset><br> <fieldset style="width:350px; height: 250px"> <h2>ABBV BY DESCRIPTION</h2> <form name = "listDESC"> <select name="abbABB"> <option value=A>AMP</option> <option value=AC>ALTERNATING CURRENT</option> <option value=ACB>AIR CIRCUIT BREAKER</option> <option value=ACI>AMERICAN CONCRETE INSTITUTE</option> <option value=AEP>AMERICAN ELECTRICAL POWER</option> <option value=AISC>AMERICAN INSTITUTE OF STEEL CONSTRUCTION</option> <option value=ANSI>AMERICAN NATIONAL STANDARDS INSTITUTE</option> <option value=ARO>AUTOMATIC RECLOSING OPERATION</option> <option value=ASCE>AMERICAN SOCIETY OF CIVIL ENGINEERS</option> <option value=ASTM>AMERICAN SOCIETY FOR TESTING AND MATERIAL</option> <option value=AUX>AUXILUARY</option> <option value=AWG>AMERICAN WIRE GAUGE</option> <option value=BCT>BUSHING CURRENT TRANSFORMER</option> <option value=BIL>BASIC INSULATION LEVEL</option> <option value=BOM>BILL OF MATERIAL</option> <option value=BPD>BUSHING POTENTIOAL DEVICE</option> <option value=BPLC>BROADBAND POWER LINE CARRIER</option> <option value=BT>BUS TIE</option> <option value=CAB>CABLE</option> <option value=CAT#>CATALOG NUMBER</option> <option value=CB>CIRCUIT BREAKER</option> <option value=CCVT>COUPLING CAPACITOR VOLTAGE TRANSFORMER</option> <option value=CS>CIRCUIT SWITCHER</option> <option value=CT>CURRENT TRANSFORMER</option> <option value=CVT>CAPACITOR VOLTAGE TRANSFORMER</option> <option value=DC>DIRECT CURRENT</option> <option value=DEB>DOUBLE END BREAK</option> <option value=DMS>DATA MANAGEMENT SYSTEM/DIGITAL METERING SYSTEM</option> <option value=FDN>FOUNDATION</option> <option value=FMP>FIELD MARKED PRINT</option> <option value=GIS>GAS INSULATED SYSTEM</option> <option value=GND,GRDG>GROUND(ING)</option> <option value=GOAB>GAS OPREATED AIR BREAK</option> <option value=GOS>GANG OPREATED SWITCH</option> <option value=IFC>ISSUE FOR CONSTRUCTION</option> <option value=KA>KILOAMP</option> <option value=KCM>KILO(1000) CIRCULAR-MILS</option> <option value=KV>KILOVOLT</option> <option value=KVAR>KILOVOLT-AMPERES REACTIVE</option> <option value=LTC>LOAD TAP CHANGER</option> <option value=MLSE>MOST LIMITING SIGNIFICANT ELEMENT</option> <option value=MOAB>MOTOR OPERATED AIR BREAK</option> <option value=MOD>MOTOR OPERATED DISCONNECT</option> <option value=MR>MATERIAL REQUEST</option> <option value=MVAR>MEGAVOLT-AMPERES REACTIVE</option> <option value=N.C.>NORMALLY CLOSED</option> <option value=N.O.>NORMALLY OPEN</option> <option value=NEMA>NATIONAL ELECTRICAL MANUFACTURER'S ASSOCIATION</option> <option value=OCB>OIL CIRCUIT BREAKER</option> <option value=OEC>OUTSOURCED ENGINEERING COMPANY</option> <option value=OLD>ONE LINE DIAGRAM</option> <option value=OSHA>OCCUPATIONAL SAFETY AND HEALTH ADMINISTRATION</option> <option value=P&C>PROTECTION AND CONTROL</option> <option value=PCIS>PROTECTION AND CONTROL INFORMATION SYSTEM</option> <option value=PCSS>PROTECTION AND CONTROL SUPPORT SERVICES</option> <option value=PED>PROTECTION EXECUTION DOCUMENT</option> <option value=POP>PHASE OVER PHASE</option> <option value=PRA>PROJECT ROUTING AND APPROVAL</option> <option value=PT>POTENTIAL TRANSFORMER</option> <option value=RIM>RELAY INSTRUMENTATION AND METERING</option> <option value=RMS>ROOT MEAN SQUARE</option> <option value=RPA>R(TU) POINT ASSIGNMENT</option> <option value=RTU>REMOTE TERMINAL UNIT</option> <option value=S/N>SERIAL NUMBER</option> <option value=SA>SURGE ARRESTOR</option> <option value=SCADA>SUPERVISORY CONTROL AND DATA ACQUISITION</option> <option value=SESS>STATION ENGINEERING SUPPORT SERVICES</option> <option value=SOW>SCOPE OF WORK</option> <option value=SW>SWITCH</option> <option value=TCR>TRANSMISSION CONSTRUCTION REPRESENTATIVE</option> <option value=V>VOLT</option> <option value=VCB>VACUUM CIRCUIT BREAKER</option> <option value=WD>WIRING DIAGRAM</option> <option value=XF>TRANSFORMER</option> </select> </form><br> <input value="Click for ABBV" onclick="findABB()" type="button"> </br></br> <input type="text" name="myresultbox2" id="resultbox2" style="width:200px; height:75px;"> </fieldset><br> </body> </html> So in summary everything is working just want to make the result in the result box be able to be clinked to a specific link assigned. Thank you in advance. Hello ! I am trying to create an auto suggest drop down. I have some ASP and Javascript code that I am using as an Autosuggest. Trouble is, the result displays on the main page, not under the text box like a drop down menu. I need help in getting the results to display correctly underneath the textbox. I have trawlled the internet and have loads and loads of code samples but I cant see the wood for the trees and I am really struggling with editing this code so that it displays correctly. clienthint.asp Code: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <html> <head> <script src="clienthint.js"></script> </head> <body> <% 'this displays the value of the textbox after the form is submitted If trim(Request("txt1")) <> "" Then Response.Write "You entered:" Response.Write "<b>" & Request("txt1") & "</b><br /><br />" End If %> <form name="form1" action="clienthint.asp" method="post"> Enter Word: <input type="text" name="txt1" id="txt1" onKeyUp="showHint(this.value,'txt1','form1',true)"> <input type="submit" name="submit" value="submit"> </form> <p>Suggestions: <span id="txtHint"></span></p> </body> </html> clienthint.js Code: var xmlHttp function showHint(str, box, thisForm, autoSubmit) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="gethint.asp"; url=url+"?q="+str; url=url+"&b="+box; url=url+"&f="+thisForm; url=url+"&a="+autoSubmit; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } //this function allows for Clickable suggestions function setTextBox(thisText,thisBox,thisForm,autoSubmit){ document.getElementById(thisBox).value = thisText //this autoSubmits the form after a suggestion is clicked - it is not working :( //if(autoSubmit=='true'){ // alert(thisForm); // document.getElementById(thisForm).submit(); //} } gethint.asp Code: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% response.expires=-1 Dim rsWords Dim rsWords_numRows Dim q Dim b Dim hint q=ucase(request.querystring("q")) b=(request.querystring("b")) f=(request.querystring("f")) a=(request.querystring("a")) hint="" Set rsWords = Server.CreateObject("ADODB.Recordset") rsWords.ActiveConnection = "Provider=SQLOLEDB; Data Source=JAGUAR\SQLEXPRESS; Initial Catalog=67625252; User ID=SFSDFSDF; Password=KJHSDHFJHDF" rsWords.Source = "SELECT * FROM Rmatable WHERE (RMA_ID LIKE'" + q + "%') ORDER BY RMA_ID" rsWords.CursorType = 2 rsWords.CursorLocation = 2 rsWords.LockType = 3 rsWords.Open() rsWords_numRows = 0 If Not rsWords.EOF Then Do While Not rsWords.EOF If trim(hint) = "" Then hint = "<a href=""javascript:setTextBox('" & rsWords("RMA_ID") & "','" & b & "','" & f & "','" & a & "');"">" & rsWords("RMA_ID") & "</a>" Else hint = hint & " , <a href=""javascript:setTextBox('" & rsWords("RMA_ID") & "','" & b & "','" & f & "','" & a & "');"">" & rsWords("RMA_ID") & "</a>" End If rsWords.MoveNext() Loop End If if trim(hint)="" then response.write("no suggestion") else response.write(hint) end if rsWords.Close() Set rsWords = Nothing %> Finally got my favorite system to work but there is 1 little detail left... When an item is in the favorites, the php file echoes: "Already Favorited!" how can I get that response? I have no experience with js whatsoever.. first time I used it. (obvious since I use code that i found on the tubes and modded it) This is my code: PHP Code: /* ---------------------------- */ /* XMLHTTPRequest Enable */ /* ---------------------------- */ function createObject() { var request_type; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_type = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_type = new XMLHttpRequest(); } return request_type; } var http = createObject(); var nocache = 0; function insert() { // Optional: Show a waiting message in the layer with ID login_response document.getElementById('insert_response').innerHTML = "Adding..." // Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding. var user_id= encodeURI(document.getElementById('user_id').value); var item_id = encodeURI(document.getElementById('item_id').value); var cat_id = encodeURI(document.getElementById('cat_id').value); // Set te random number to add to URL request nocache = Math.floor(Math.random()); // Pass the login variables like URL variable http.open('get', 'http://animekyun.com/scripts/favorite.php?user_id='+user_id+'&item_id=' +item_id+'&cat_id=' +cat_id); http.onreadystatechange = insertReply; http.send(null); } function insertReply() { if(http.readyState == 4){ var response = http.responseText; document.getElementById('insert_response').innerHTML = 'Favorited'+response; } } Apparently this http.responseText is not working propperly since it's not returning anything Hey Forum, I have this little script working great when all if's are seperated. what i need is to have the script read if one of these fields has a value then result=true. as you see the script now i have this seperated in many different if's for all three text fields. I need to put all text fields like they were one, thanks Code: function ValidateLink(Form) { var result = true; if (formMyLocations.cellAddress.value.length == 0) { alert('Cell address is empty on the locations page'); result = false; } if (formMyLocations.homeAddress.value.length == 0) { alert('Home address is empty on the locations page'); result = false; } if (formMyLocations.carAddress.value.length == 0) { alert('Car address is empty on the locations page'); result = false; } return result; } When I hit the submit button, the result are display on a new page. how do I force it to stay on the same page, here's my code. Code: <HTML> <HEAD> <TITLE>Test Input</TITLE> <script type="text/javascript"> function addtext() { var newtext = document.myform.inputbox.value; document.writeln(newtext); } </script> </HEAD> <BODY> <FORM NAME="myform">Enter something in the box: <BR> <INPUT TYPE="text" NAME="inputbox" VALUE=""> <INPUT TYPE="button" NAME="button" Value="Check" onClick="addtext()"> </FORM> </BODY> </HTML> any comments or suggestions would be greatly appreciated. Can any one help me out please, i have two forms result and i need a function to sum and display the two forms result into one <html> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function sum() { var one = parseFloat(document.myform.cost.value) var two = parseFloat(document.myform.insurance.value) var prod = one * two document.myform.amount.value=custRound(prod,2); } function custRound(x,places) { return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places) } var Cost, GST, PST, Grand_Total; function tally() { Cost = 0; if (document.orderform.Item1.checked) { Cost = Cost + 26.15; } if (document.orderform.Item2.checked) { Cost = Cost + 26.10; } if (document.orderform.Item3.checked) { Cost = Cost + 26; } if (document.orderform.Item4.checked) { Cost = Cost + 26; } if (document.orderform.Item5.checked) { Cost = Cost + 26.44; } if (document.orderform.Item6.checked) { Cost = Cost + 26.01; } if (document.orderform.Item7.checked) { Cost = Cost + 26; } if (document.orderform.Item8.checked) { Cost = Cost + 26; } if (document.orderform.Item9.checked) { Cost = Cost + 25; } GST = (Cost * 0.07); PST = (Cost * 0.07); Cost = dollar(Cost); GST = dollar(GST); PST = dollar(PST); Grand_Total = parseFloat(Cost) + parseFloat(GST) + parseFloat(PST) ; Grand_Total = dollar(Grand_Total); document.orderform.Total.value = "$" + Cost; document.orderform.GST.value = "$" + GST; document.orderform.PST.value = "$" + PST; document.orderform.GrandTotal.value = "$" + Grand_Total; } function dollar (amount) { amount = parseInt(amount * 100); amount = parseFloat(amount/100); if (((amount) == Math.floor(amount)) && ((amount - Math.floor (amount)) == 0)) { amount = amount + ".00" return amount; } if ( ((amount * 10) - Math.floor(amount * 10)) == 0) { amount = amount + "0"; return amount; } if ( ((amount * 100) - Math.floor(amount * 100)) == 0) { amount = amount; return amount; } return amount; } </SCRIPT> </HEAD> <BODY> <H1 ALIGN = CENTER> in</H1> <H2 ALIGN = CENTER> PLEASE GET A QUOTE</H2> <FORM NAME="myform"> <P><B>VALUE OF Vehicle:</B> <input type="text" name="cost" onClick="sum()"> <P><B>Type of Insurance</B> <select name="insurance"> <option value="1.175" selected>Comprehensive</option> <option value="1.00">Third party only </option> <option value="0.75">Third party and thift</option> </select> <BR><input type="button" value="Get Quote" onClick="sum()" name="button"> <P>YOUR QUOTE </P> <input type="text" onClick="sum()" name="amount"> </FORM> </CENTER> <form method="post" name="orderform" action="mailto:ioduwa@yahoo.com" enctype="text/plain""> <table border="0"> <tr><td colspan="4"> <p><input type="checkbox" name="Item1" value="Item1_chosen" onclick="tally()"> Item One <p><input type="checkbox" name="Item2" value="Item2_chosen" onclick="tally()"> Item Two <p><input type="checkbox" name="Item3" value="Item3_chosen" onclick="tally()"> Item Three <p><input type="checkbox" name="Item4" value="Item4_chosen" onclick="tally()"> Item Four <p><input type="checkbox" name="Item5" value="Item5_chosen" onclick="tally()"> Item Five <p><input type="checkbox" name="Item6" value="Item6_chosen" onclick="tally()"> Item Six <p><input type="checkbox" name="Item7" value="Item7_chosen" onclick="tally()"> Item Seven <p><input type="checkbox" name="Item8" value="Item8_chosen" onclick="tally()"> Item Eight <p><input type="checkbox" name="Item9" value="Item9_chosen" onclick="tally()"> Item Nine </td></tr> <tr> <td> Total <input type="text" name="Total" value="$0" size="7"></td> <td> PST (7%) <input type="text" name="PST" value="$0" size="6"></td> <td colspan="2"> GST (7%) <input type="text" name="GST" value="$0" size="6"></td> </tr> <tr> <td> Grand Total <input type="text" name="GrandTotal" value="$0" size="8"></td> </tr> <tr> <td>Company Name:</td> <td colspan="3"><input type="Text" name="Company" size="35" maxlength="40"></td> </tr> <tr> <td>Contact Name:</td> <td colspan="3">First <input type="Text" name="FirstName" size="15" maxlength="20"> Last <input type="Text" name="LastName" size="15" maxlength="20"></td> </tr> <tr> <td>Address</td> <td><input type="Text" name="Street" size="20" maxlength="40"></td> </tr> <tr> <td>City</td> <td><input type="Text" name="City" size="20" maxlength="20"> </td> <td>Province/State:</td> <td><input type="Text" name="Province" size="20" maxlength="40"></td> </tr> <tr> <td>Country:</td> <td><input type="Text" name="Country" size="20" maxlength="20"></td> <td>Code:</td> <td><input type="Text" name="Code" size="9" maxlength="10"></td> </tr> <tr> <td>Phone:</td> <td><input type="Text" name="Area" size="3" maxlength="5"> <input type="Text" name="Phone" size="8" maxlength="10"></td> <td>Fax:</td> <td><input type="Text" name="AreaFax" size="3" maxlength="5"> <input type="Text" name="Fax" size="8" maxlength="10"></td> </tr> <tr> <td>Email Address:</td> <td colspan=2><input type="Text" name="Email" size="30" maxlength="30"></td> </tr> <tr><td colspan="4" height="3"><hr></td></tr> <tr><td colspan="2" align="center"><input type="Submit" value="Send Order"></td> <td colspan="2" align="center"><input type="RESET" value="Reset Order"></td></tr> </table> </form> </html> I wrote quiz using HTML and JavaScrip. Score is accumulated in a variable called myScore. Now I want to email the result of myScore to an email address. How do I go about doing this? I don't want to use the mailto: command since that require that user actually press the send command to send the email. I want this done automatically after user finishes the quiz. Please explain all replied in details since I am new to JavaScript and still learning. Hi, I am facing a problem in passing replace() function as an argument in user defined java function, can any one help me how to resolve it? intention is to pass a file path to my user defined function, but before passing the path i want to replace the character '\' to '\\' I am posting my javascript function he <a href="#" onclick="OpenDocPreview('<%# Eval("PATH")%>'.replace(/\\/g,"\\\\"), '<%# Eval("Filename")%>')"><%# Eval("DocTitle") %></a> function OpenDocPreview(url, docname) { alert('message from search base : ' + url + ' ' + docname); } thank you, |