JavaScript - Simple Javascript Toggle
I'm sure this is a simple thing to do, but I know next to zero javascript and can't find an example online.
What I want to do is to toggle a number on a webpage when a user clicks a link. So ideally there would be a "click to toggle" link, and then a number (lets say 400), when the user clicks that toggle link the number would change to 800 (or whatever my variable is set to), when they click it again it would go back to that original number (in this case 400). Would someone be kind enough to help me with this? Thanks Similar TutorialsI've written this very small and simple javascript toggle to make a div appear and disappear upon click. Code: function dropDown(id){ var object = document.getElementById(id).style; if (object.display == "none") {object.display = "block"} else {object.display = "none"} } And the html: Code: <div id="webBox" class="service"> <ul class="servNav"> <li class="button" onclick="dropDown('webDrop')">View Details</li> </ul> </div> <div class="dropInfo" id="webDrop"> Now this code DOES work, but only after clicking the button twice. I assume there is some argument problem, but I can't seem to pinpoint it. I've got jquery scripts and plugins on the page, but it does the same thing when I take those off. Is there anything I can do to make the toggle immediate rather than after a couple tries of clicking? The URL is http://mattboldt.com/2.0 The "view details" buttons are what I'm having trouble with. As of now it's only on one, the first div. Thanks. Following are my script to toggle b/w two different links, <html lang="en-US"> <head> <title>toggle b/w 2 different links</title> <script type="text/javascript"><!-- display=1; function displayvalue() { document.getElementById("sv1").style.display = "block"; document.getElementById("dw1").style.display = "none"; } function ShowHide() { if (display==1) { document.getElementById("sv1").style.display = "none"; document.getElementById("dw1").style.display = "block"; //document.getElementById('javaFun') calling java func from javascript display=2; } else { document.getElementById("sv1").style.display = "block"; document.getElementById("dw1").style.display = "none"; //document.getElementById('javaFun1') calling java func from javascript display=1; } } function Func1Delay() { document.getElementById("sv1").style.display = "none"; document.getElementById("loadimage").innerHTML="<input type='image' src='Loading.gif'>"; setTimeout("LoadImage()", 300); } function LoadImage() { document.getElementById("loadimage").innerHTML=""; ShowHide(); } --></script> </head> <body background="GsNJNwuI-UM.gif"onload="displayvalue()"> <div id="sv1" > <a onclick ="Func1Delay()" href="javascript:;">click me</a> </div> <div id="loadimage"></div> <div id="dw1" > <a onclick ="ShowHide()" href="javascript:;">Download me</a> </div> </body> </html> whenever we call a java method , (consider this line:- document.getElementById('javaFun');)after the completion of java call the page is reloading, how control this reloading after the server completing the request....? I am very new to this, so I appreciate everyone's help and patience I am displaying information on our company intranet. I want the user to be able to choice if they want to see the information sorted by person or by issue. Because of the way that this is setup, the info is not in a table and cannot be sorted. I want users to be able to view content either way, but with only one option being visible. This would require the OR operator combined with the toggle function (I assume), but I am pretty lost... This toggle below allows me to show/hide one on top of the other, but I want one to replace the other: <SCRIPT type=text/javascript> <!-- function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } //--> </SCRIPT> <P><STRONG><FONT color=#00467f size=3>Primary Contacts</FONT></STRONG></P> <P><A onclick="toggle_visibility('issue');" href="#">Toggle Contacts by Issue</A></P> <P> </P> <DIV style="DISPLAY: none" id=issue>%%Pages.Body PageID="596"%%</DIV> <DIV style="DISPLAY: block" id=pers>%%Pages.Body PageID="595"%%</DIV> Again, I really appreciate the help Hi there! Okay, here is my scenario: I have a link and a div on a webpage. With the link I want to toggle the content (HTML) of the div. On toggle, I want to load the content from a PHP-file and I want it to load on the toggle, not when the webpage originally loaded (to reduce loading time on the webpage itself). The file that is loaded on toggle doesn't have to be PHP, but it would help a lot. Does anybody know of a example of this or something similar to it? I have been looking for some time now, without any luck unfortunately. Highly appreciate any help/answers/feedback! I'm trying to create a forum for a business. The forum will change depending on what checkbox a person checks in the beginning. I have the checkboxes toggle a certain span. When you check one box it hides one span and displays the other. This works, but I want to position the displayed span at the top so a person doesn't have to look for the other forum. Right now there is just a big white space in the place of the hidden span, so it looks like there is nothing else on the page. I want to move the bottom span to the top when toggled. Here is my code so far. <form name="form1" method="post" action=""> Pork <INPUT TYPE=checkbox NAME="chbx" onClick="selecionatudo(true,1); toggleT('divt1','h'); toggleT('divt2','s')"> Beef <INPUT TYPE=checkbox NAME="chbx" onClick="selecionatudo(true,2); toggleT('divt1','s'); toggleT('divt2','h')"><br> </FORM> <form> <p><div id="divt1" style="visibility:visible; position:relative; top:0; left:0; overflow: visible;"> Shoulder: <br /> Ground beef:<input type="checkbox" name="Grinding" id="Ground beef" /><br /> Patties: Fresh<input type="checkbox" name="pattiesfr" id="Pattiesfr" /> or Seasoned<input type="checkbox" name="pattiesS" id="PattiesS" /><br /> Minute Steaks: <input type="checkbox" name="minsteaks" id="minsteaks" /><br /> Specific Cuts wanted:<br /> <textarea name="Order Sheet" cols="60" rows="30" id="Order Sheet"></textarea> </div> </form><br /> <div id="divt2" style="visibility:visible; position:absolute; top "> Type 2 Input: <input name="t2" type="text" value=""> </div> <BR> </p> <script type=text/javascript> var isIE=document.all?true:false; var isDOM=document.getElementById?true:false; var isNS4=document.layers?true:false; /* _w : which ID (1) or (2) */ /* _h : (h)ide or (s)how */ function toggleT(_w,_h) { if (isDOM) { if (_h=='s') document.getElementById(_w).style.visibility='visible'; if (_h=='h') document.getElementById(_w).style.visibility='hidden'; } else if (isIE) { if (_h=='s') eval("document.all."+_w+".style.visibility='visible';"); if (_h=='h') eval("document.all."+_w+".style.visibility='hidden';"); } else if(isNS4) { if (_h=='s') eval("document.layers['"+_w+"'].visibility='show';"); if (_h=='h') eval("document.layers['"+_w+"'].visibility='hide';"); } } </script> Is it possible for JavaSscript to toggle a submit button? I will be using it in this code: Code: <SCRIPT type="text/javascript"> if (document.forms["form"]["quantitys"].value > '.$row['quantity'].') { alert ("The quantity you wanted for product '.$row['id'].' is no longer available and will be changed to the highest available quantity."); document.forms["form"]["quantity"].value = '.$row['quantity'].'; // JAVASCRIPT TOGGLE SUBMIT } </SCRIPT> The submit button: <INPUT name="submit" type="submit" value="UPDATE QUANTITY"> Hello to all. I am a new to the forum and new to Javascript, so please be gentle. I have a web page in which I am using a script to toggle between div tags. I learned how to set it up for only a few divs, but want to use more than 10+ div tags with the corresponding buttons on the side. When I set it up with 11 buttons, the 10th button does not work, but all of the single digit buttons do. (The 11th button is going to be a hyperlink eventually.) Here is the code for anyone who can help: <code> <script language="javascript" type="text/javascript"> function Button(obj) { var cls = obj.className; if(cls!='Btn_Selected') { if(cls=='Btn') { cls = 'Btn_Highlight'; } else { cls = 'Btn'; } } obj.className = cls; } function select(obj) { for (var x = 1; x <= 10; x++) { document.getElementById("Button"+x).className = 'Btn'; document.getElementById("Content"+x).style.display = 'none'; } obj.className='Btn_Selected'; var tmp = obj.id; var num = tmp.substr(tmp.length-1); document.getElementById("Content"+num).style.display = 'block'; } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> </code> Hopefully I was clear with what I am looking to achieve. If I need to attach additional code or a link to the web page, let me know. Any help would be greatly appreciated. Thanks All in advance, ScottoNM Im creating a portfolio site for myself that my have gotten a little too ambitious but I'd still like to make this work. My main site loads a video demo reel using the new <video> tag and to make it look cooler has an "ambilight" television effect around it. For usability and for users that find it annoying or distracting I want a toggle to turn the effect off. I have my checkbox created as well as all the effects working for it. Here is a piece of the main code as well as a link to the ambilight.js file Code: <label name="ambilightToggle"> <input type="checkbox" name="toggle"/> <div class="toggle-switch"> <div class="handle"></div> <div class="track"> <span>OFF</span><span>ON</span> </div> </div> </label> </div> </div> <div id="main" class="clearfix"> <div id="video-edge"> <img id="ribbon" width="112" height="112" alt="Demo Reel Ribbon" src="img/ribbon-demoreel.png"> <div id="video-wrap" class="video-js-box moo-css"> <video id="example" class="video-js" width="720" height="405" controls preload poster="posters/poster_demoreel2010.png"> <source src="video/demoreel2010.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /> <source src="video/demereel2010.webm" type='video/webm; codecs="vp8, vorbis"' /> <source src="video/demoreel2010.ogv" type='video/ogg; codecs="theora, vorbis"' /> </video> </div> </div> <script type="text/javascript"> ambiLight.create(document.getElementById('example')) </script> Portfolio Page http://www.eschulist.com/test/js/ambilight.js I was able to make the ambilight effect go away using this, but it only works for a second as the video continues to play and the new lights are redrawn. Code: <script type="text/javascript"> $(document).ready(function(){ $(this).click(function(){ $('canvas.ambilight-left, canvas.ambilight-right').addClass('goAway'); }); }); </script> Any other ideas on what to do? If the click function works I should be able to have it check the checkboxes state and have it persist. Maybe? I imagine this would be very simple for someone who knows javascript. I want to have three fields. First field is "posted speed limit", second field is "actual speed" and third field will be the output field. All the script needs to do it subtract the posted speed from the actual speed and add a ZERO to the end; which is the amount of the speeding ticket. The minimum fine is $100, however. So, 5 miles over the speed limit would be $100 (minimum value) 15 miles over the speed limit would be $150 (add a zero) 35 miles over the speed limit would be $350. etc. I know very little Javascript, if anyone could help me out with this, I'd appreciate it. Thanks, Sean i have this simple js example to click Delete Post and then give the user two options. If they click yes then they go that page...but how do i set it to where when they click cancel it goes back to "Delete Post" ??? i suck at javascript Code: <html> <body> <p><b>Delete Post</b></p> <script type="text/javascript"> window.onclick=function(){ document.getElementsByTagName("p")[0].innerHTML="<b><a href='#'>Delete</a> || Cancel</b>" } </script> </body> </html> Hi, I have some Javascript, what I want to hapen is, when the variables hour and randomhour are the same, the message hello is displayed. What actually happens is the message will display all the time, and dissapear when randomhour is 0. Here is my script: Code: <script type="text/javascript"> //Gets hour and minute of day var d = new Date(); var hour = d.getHours(); var minute = d.getMinutes(); //Generates a random hour and minute var randomhour=Math.floor(Math.random()*24) var randomminute=Math.floor(Math.random()*60) document.write(hour); document.write(minute); document.write("----"); document.write(randomhour); document.write(randomminute); if (hour = randomhour) { document.write("<b>Hello</b>"); } </script> Hello! This is my first post here. I am not a programmer and I thought you guys would be able to help me. I have this script in one of my pages. It was written by a former coworker. It worked perfectly in Firefox 3.6 but stopped working after browser upgrades. It may be a simple fix... I just don't know. Any help would be GREATLY appreciated. Here is the code in the HEAD: Code: <script type="text/javascript"> function generateAnswer() { //alert("answersheet"); window.open("answerSheet.html" + window.location.search); } </script> And here is the code in the BODY, where the script is called: Code: <p>Generate the answer sheet for the tests you have selected: <a href="javascript:generateAnswer()">Generate</a></p> When the page runs, I can see the "Generate" link, but it takes me nowhere. Can anyone help me with doing this? I'm kinda new to JavaScript! Create an Array (list) containing 10 words. For every half second going word by word appears in a <span> element. When all the words in the list are gone through, the interval shall stop and printing "The End". Hi guys, I have this piece of php code: PHP Code: <?php $file = 'counter.txt'; $data = @file($file); $data = $data[0]; if($handle = @fopen($file, 'w')){ $data = intval($data); $data++; fwrite($handle, $data); fclose($handle); } ?> What I need to know is, can javascript activate this piece of php code with an onclick function to make it write to the txt file? I have a link that downloads a file and would like to add a little javascript onclick function to write to the text file (as in the php code above) at the same time as they download the file. I was not sure if this was possible in the same way you would do something like: window.location.href='http://www.yoursite.com'; Any help is hugly appreciated. Kind regards, paffley I'm trying to code a set of buttons that upon being pressed, change an image on the other side of the table in which they're located (not themselves). Is there a way to do this and if so, what would it be? So far I've been trying to use onMouseDown and changeImage with object id tags to get the effect but it's not working. I'm brand new to javascript and have a simple assignment that I'm stuck on. I would appreciate any help. Here's what I want: 0:0 1:1 2:3 3:6 4:10 5:15 As you can see, I want the numbers after the colon to be a sum of the number to the left and the number above it. I can easily get the number before the colon, but not sure how to get the sum (the number after the semicolon). Here's my code so far: <html> <body> <script type="text/javascript"> N=0; while (N<=5) { document.write(+ N); N++; document.write(":"); document.write("<br />"); } </script> </body> </html> I need to use a loop, hence the "while" loop. But not sure how to set up variables to do the addition. Thanks much for any help - as you can see, I'm not a programmer. i want a simple javascript countdown that counts down from 10 seconds to 0 and does NOTHING ELSE. im redirecting the page with a meta refresh and i want users to know when they'll be redirected, but most of the scripts found online have either minutes, hours, or days in them or have a javascript countdown after it's finished, which i don't want either since i'm doing a meta refresh. i know making something like this isnt rocket science but i know almost NOTHING about javascript I have a script that includes a JS delete function, but when I select a record and hit delete it says no record is selected. I'm sure this is a simple fix for someone in the know. Thanks in advance. Site: PHP Code: <?php require_once('auth.php'); ?> <script type="text/javascript" src="script.js"> </script> <?php include("header.php"); ?> <b><div align="right"><a href="admin-index.php">Admin</a> - <a href="adminorders.php">Orders</a> - <a href="adminmain_forum.php">Support</a> - <a href="register-form.php">Add User</a> - <a href="adminlogout.php">Logout</a></div></b><br> <b>Report Upload</b> <br>To upload reports after completion use the form below and update the order with the report URL (/reports/filename). <center><form action="./uploadadmin.php" method="post" enctype="multipart/form-data"> <p> <label for="file">Select a file:</label> <input type="file" name="userfile" id="file"> <br /> <p><button>Upload File</button> <p> </form></center> <p><b>Previous Orders</b> <br>Details of previous orders and trials are displayed below. <br><script> <!-- Hide from old browsers /****************************************** * Find In Page Script -- Submitted/revised by Alan Koontz (alankoontz@REMOVETHISyahoo.com) * Visit Dynamic Drive (http://www.dynamicdrive.com/) for full source code * This notice must stay intact for use ******************************************/ // revised by Alan Koontz -- May 2003 var TRange = null; var dupeRange = null; var TestRange = null; var win = null; // SELECTED BROWSER SNIFFER COMPONENTS DOCUMENTED AT // http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html var nom = navigator.appName.toLowerCase(); var agt = navigator.userAgent.toLowerCase(); var is_major = parseInt(navigator.appVersion); var is_minor = parseFloat(navigator.appVersion); var is_ie = (agt.indexOf("msie") != -1); var is_ie4up = (is_ie && (is_major >= 4)); var is_not_moz = (agt.indexOf('netscape')!=-1) var is_nav = (nom.indexOf('netscape')!=-1); var is_nav4 = (is_nav && (is_major == 4)); var is_mac = (agt.indexOf("mac")!=-1); var is_gecko = (agt.indexOf('gecko') != -1); var is_opera = (agt.indexOf("opera") != -1); // GECKO REVISION var is_rev=0 if (is_gecko) { temp = agt.split("rv:") is_rev = parseFloat(temp[1]) } // USE THE FOLLOWING VARIABLE TO CONFIGURE FRAMES TO SEARCH // (SELF OR CHILD FRAME) // If you want to search another frame, change from "self" to // the name of the target frame: // e.g., var frametosearch = 'main' //var frametosearch = 'main'; var frametosearch = self; function search(whichform, whichframe) { // TEST FOR IE5 FOR MAC (NO DOCUMENTATION) if (is_ie4up && is_mac) return; // TEST FOR NAV 6 (NO DOCUMENTATION) if (is_gecko && (is_rev <1)) return; // TEST FOR Opera (NO DOCUMENTATION) if (is_opera) return; // INITIALIZATIONS FOR FIND-IN-PAGE SEARCHES if(whichform.findthis.value!=null && whichform.findthis.value!='') { str = whichform.findthis.value; win = whichframe; var frameval=false; if(win!=self) { frameval=true; // this will enable Nav7 to search child frame win = parent.frames[whichframe]; } } else return; // i.e., no search string was entered var strFound; // NAVIGATOR 4 SPECIFIC CODE if(is_nav4 && (is_minor < 5)) { strFound=win.find(str); // case insensitive, forward search by default // There are 3 arguments available: // searchString: type string and it's the item to be searched // caseSensitive: boolean -- is search case sensitive? // backwards: boolean --should we also search backwards? // strFound=win.find(str, false, false) is the explicit // version of the above // The Mac version of Nav4 has wrapAround, but // cannot be specified in JS } // NAVIGATOR 7 and Mozilla rev 1+ SPECIFIC CODE (WILL NOT WORK WITH NAVIGATOR 6) if (is_gecko && (is_rev >= 1)) { if(frameval!=false) win.focus(); // force search in specified child frame strFound=win.find(str, false, false, true, false, frameval, false); // The following statement enables reversion of focus // back to the search box after each search event // allowing the user to press the ENTER key instead // of clicking the search button to continue search. // Note: tends to be buggy in Mozilla as of 1.3.1 // (see www.mozilla.org) so is excluded from users // of that browser. if (is_not_moz) whichform.findthis.focus(); // There are 7 arguments available: // searchString: type string and it's the item to be searched // caseSensitive: boolean -- is search case sensitive? // backwards: boolean --should we also search backwards? // wrapAround: boolean -- should we wrap the search? // wholeWord: boolean: should we search only for whole words // searchInFrames: boolean -- should we search in frames? // showDialog: boolean -- should we show the Find Dialog? } if (is_ie4up) { // EXPLORER-SPECIFIC CODE revised 5/21/03 if (TRange!=null) { TestRange=win.document.body.createTextRange(); if (dupeRange.inRange(TestRange)) { TRange.collapse(false); strFound=TRange.findText(str); if (strFound) { //the following line added by Mike and Susan Keenan, 7 June 2003 win.document.body.scrollTop = win.document.body.scrollTop + TRange.offsetTop; TRange.select(); } } else { TRange=win.document.body.createTextRange(); TRange.collapse(false); strFound=TRange.findText(str); if (strFound) { //the following line added by Mike and Susan Keenan, 7 June 2003 win.document.body.scrollTop = TRange.offsetTop; TRange.select(); } } } if (TRange==null || strFound==0) { TRange=win.document.body.createTextRange(); dupeRange = TRange.duplicate(); strFound=TRange.findText(str); if (strFound) { //the following line added by Mike and Susan Keenan, 7 June 2003 win.document.body.scrollTop = TRange.offsetTop; TRange.select(); } } } if (!strFound) alert ("Order '"+str+"' not found!") // string not found } // --> </script> <!-- EXAMPLE FORM OF FIND-IN-PAGE SEARCH USING SUBMIT (ALLOWING 'ENTER/RETURN' KEY PRESS EVENT) --> <center><b>Enter order number</b> <form name="form1" onSubmit="search(document.form1, frametosearch); return false"><input type="text" name="findthis" size="15" title="Press 'ALT s' after clicking submit to repeatedly search page"> <input type="submit" value="Search Orders" ACCESSKEY="s"></form></center> <br><br><table width="775" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td> <form action="" method="post" name="" id=""> <table width="600" border="1" align="center" cellpadding="2" cellspacing="2"> <tr> <td><input name="topcheckbox" type="checkbox" class="check" id="topcheckbox" onClick="selectall();" value="ON"> Select All </td> <td colspan="4" align="center"><a href="form.php?mode=add">Add New Order</a></td> </tr> <tr> <td><strong><a href="javascript:goDel()">Delete</a></strong></td> <td><strong>Order Number</strong></td> <td><strong>Order Status</strong></td> <td><strong>Payment Status</strong></td> <td><strong>Update</strong></td> </tr> <? include("conn.php"); $sql="select sn,branchname,shortname,payment from $branch order by sn"; $result=mysql_query($sql,$connection) or die(mysql_error()); while($row=mysql_fetch_array($result)) { ?> <tr> <td><input name="<? echo $row['sn']; ?>" type="checkbox" class="check"></td> <td><? echo $row['branchname']; ?></td> <td><? echo $row['shortname']; ?></td> <td><? echo $row['payment']; ?></td> <td><a href="<? echo "form.php?sn=".$row['sn']."&mode=update"; ?>">Update</a></td> </tr> <? } ?> <tr> <td><strong><a href="javascript:goDel()">Delete</a></strong></td> <td><strong>Order Number</strong></td> <td><strong>Order Status</strong></td> <td><strong>Payment Status</strong></td> <td><strong>Update</strong></td> </tr> </table> </form></td> </tr> </table> <?php include("footer.php"); ?> JS File Code: function goDel() { var recslen = document.forms[0].length; var checkboxes="" for(i=1;i<recslen;i++) { if(document.forms[0].elements[i].checked==true) checkboxes+= " " + document.forms[0].elements[i].name } if(checkboxes.length>0) { var con=confirm("Are you sure you want to delete"); if(con) { document.forms[0].action="delete.php?recsno="+checkboxes document.forms[0].submit() } } else { alert("No record is selected.") } } function selectall() { // var formname=document.getElementById(formname); var recslen = document.forms[0].length; if(document.forms[0].topcheckbox.checked==true) { for(i=1;i<recslen;i++) { document.forms[0].elements[i].checked=true; } } else { for(i=1;i<recslen;i++) document.forms[0].elements[i].checked=false; } } Hi, Am new to this forum and even newer to java. I was trying to make a simple code for a form calculation, as always i end up failing Can any one tell me where i went wrong with this script? JAVA Script Code: function meldCalc(form) { var PBil = form.PBil.value; var PINR = form.PINR.value; var PCr = form.PCr.value; if (!checkNum(PBil,"serum bilirubin")) { form.PBil.select(); form.PBil.focus(); return false } if (!checkNum(PINR,"blood inr")) { form.PINR.focus(); form.PINR.select(); return false } if (!checkNum(PCr,"plasma creatinine")) { form.PCr.select(); form.PCr.focus(); return false } var meld = (0.957 * (Pcr) + 0.378 * (PBil) + 1.120 * (PINR) + 0.643 ) * 10; form.meld.value = meld; return true; } HTML CODE Code: <form name="meld" method=post> <table border=0 bgcolor="" cellspacing=0 cellpadding=3> <tr> <th align=left class=tdtext> Bilirubin: </th> <td> </td> </tr> <tr> <td align=right class=tdtext> Serum (P<sub>Bil</sub>): </td> <td align=left class=tdtext> <input type=text value="" size="4" maxlength="4" name="PBil"> mg/dL </td> </tr> <tr> <th align=left class=tdtext> INR: </th> <td> </td> </tr> <tr> <td align=right class=tdtext> Blood (P<sub>INR</sub>): </td> <td align=left class=tdtext> <input type=text value="" size="4" maxlength="4" name="PINR"> Number </td> </tr> <tr bgcolor=""> <th align=left class=tdtext> Creatinine: </th> <td> </td> </tr> <tr bgcolor=""> <td align=right class=tdtext> Serum (P<sub>Cr</sub>): </td> <td align=left class=tdtext> <input type=text value="" size="4" maxlength="4" name="PCr"> mg/dl </td> </tr> <tr bgcolor=""> <td> </td> <td align=center> <input type=button name=button value="Get MELD" onClick="meldCalc(this.form)"> </td> </tr> <tr bgcolor="#cccccc"> <th align=right class=tdtext style="font-size:0.12in;"> MELD = </th> <td align=left class=tdtext> <input type=text value="" size="3" maxlength="3" name="meld"> </td> </tr> Thx in advance for any help, |