JavaScript - Programming A Car Calculator In Java Script
I am trying to create a form where you are able to calculate what a total car cost would be based on a 6.25% of the CarAmount. Then I would like to be able to add $125 that with is TitleProcess and then $99 to that which is the LicenseFee. Right now I have not been able to get the tax to work on this code. If someone could get this all to work that would be great, or else even if you program your own code.
Thank you so much! <form action="POST" name="myform"> <table border="1" bgcolor="#006666"> <tr> <td align="center" colspan="2"> <script language="JavaScript"><!-- function CarLoanCalculator() { form = document.myform CarAmount= form.CarAmount.value DownPayment= "0" AnnualInterestRate = 625/100 TitleProcess= 125 MonthRate=AnnualInterestRate/12 NumPayments=TitleProcess*12 Prin=CarAmount-DownPayment MonthPayment=Math.floor((CarAmount*AnnualInterestRate)+TitleProcess)) form.NumberOfPayments.value=NumPayments form.MonthlyPayment.value=MonthPayment } // --></script> <font color="#FFFFFF" size="2" face="arial narrow"><b>Car Loan Calculator</b> <br> Enter Your Details & Click the Calculate Button</font></td> </tr> <tr> <td> <table border="0" cellpadding="2"> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Car Loan Amount $ </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="10" name="CarAmount" value="" onBlur="CarLoanCalculator()" onChange="CarLoanCalculator()"> <br> </font></td> </tr> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Annual Interest Rate </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="3" name="InterestRate" value="6.25" onBlur="CarLoanCalculator()" onChange="CarLoanCalculator()"> % <br> </font></td> </tr> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Term of Car Loan </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="3" name="NumberOfTitleProcess" value="125" onBlur="CarLoanCalculator()" onChange="CarLoanCalculator()"> TitleProcess<br> </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="button" name="morgcal" value="Calculate" language="JavaScript" onClick="CarLoanCalculator()"> </font></td> </tr> <tr> <td colspan="3"><font color="#FFFFFF"></font></td> </tr> </table> </td> </tr> <tr> <td> <table border="0" cellpadding="2"> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow"> Number of Car Payments </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="7" name="NumberOfPayments"> <br> </font></td> </tr> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Monthly Payment $ </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="7" name="MonthlyPayment"> <br> </font></td> </tr> <tr> <td align="center" colspan="2"> </td> </tr> </table> </td> </tr> </table> <div align="center"></div> </form> Similar TutorialsHi All, Could you please help me in finding a java script for 1031 exchange calculator? Its very urgent and have to complete ASAP. Please help me. Thanks hi again, I want to say thank you for all of the help and I have the last assignment that she wants us to do and I had to pull up another assignment that she wanted us to build upon( which is one of those coding without anything advance) Code: <html> <head> <title> COMSC 100 Assignment 10 by Dennis McNeill [1190802] </title> <script> function getInputAsText(_id){return document.getElementById(_id).value} function getInputAsNumber(_id){return parseFloat(document.getElementById(_id).value)} function setOutput(_id, _value){document.getElementById(_id).value = _value} function calculate() { // declare all variables var variable1 var variable2 var variable3 var variable4 var variable5 // get variable's value = getInputAsNumber() = getInputAsNumber() // perform concatenation // write output value setOutput("resultAsText",resultAsNumber) } </script> </head> <body> Directions:<br> Type 5 numbers and click go<br> The highest of the 5 will appear<br> It is okay to use a decimal point<br> Input values:<br> First<input id="variable1"><br> Second<input id="variable2"><br> Third <input id="variable3"><br> Fourth<input id="variable4"><br> Fifth<input id="variable5"><br> <input type="submit" value="go" onclick="calculate()"> Output<br> Result #1:<input id= "myResult1" size="25"> </body> </html> now she wants us to do max <beta and then name the variables with if a<b and I don't know if I put that in the concatenation or what to name my variables! ugh. NOT ASKING TO DO MY HOMEWORK I'm trynna make a website, its gonna be like, a game making website I plan to keep it as simple as possible for now, but once I get better at it.. anyways, I'm trying to figure out how I would do things such as: click, drag and drop right click, select something and make it appear on screen make something happen on keydown events hi i am new to programming and script writing i would like to ask if anyone on here wouldn't mind taking a couple min out of there day to help me out with a few things I am really stuck right now on just getting started with what i need to START i know that that is probably a pretty big question so i will start out small and just ask what are some of the basic essentialls that i will need to get started. Wile telling me how to get started if you wouldn't mind just giving me a short description of the proper use of thing and just what i should look for if i am doing things properly or incorrect like i said before i am only just starting out and i would like to start small and just more or less get the ball rolling. I work with computers most of the day and hooking up internet and would like to further my knowledge with the future (computers). i am a part of lots of forums mainly pertaining to jeeps and we are always trying to help the little guys out in getting bigger and more knowledgeable about what they are getting into and i am hopping that it is the same way here and in this area or expertise thanks again i look forward to starting out I purchased this debt calculator about 6 months ago and thought it was working fine. Turns out that when you enter in 30 for the average interest rate a Warning: Unresponsive Script window pops up and forces you to stop the script. I am very novice to Javascript and tried looking through the code to see if I could find the problem, with no success. I would appreciate it greatly if someone could take a look to see what is wrong. Here is the link to the calculator. http://www.federaldebtreduction.com/calculator.html Thank You. Code: function $(id){ return document.getElementById(id); } var payTotal = 0; var GRAPH_MAX_HEIGHT = 140 function calculate(){ var MINIMUM_PAYMENT_PERCENT = .025; var OUR_FEE_PERCENT = .0; var OUR_FEE_MISC_PERCENT = .64; var loanAmount = $("loanamount").value; var interest = $("interest").value; var clearingDuration = $("monthstopaypoff").value; loanAmount = loanAmount.replace(/\$/g,''); loanAmount = loanAmount.replace(/,/g,''); loanAmount = isNaN(loanAmount)?0:parseInt(loanAmount); var interest = interest.replace(/\%/g,'') / 100; interest = isNaN(interest)?0:interest; var sloan = formatCurrency(loanAmount); // set amount for Total Unsecured Debt updateData('tud_loan', sloan); updateData('cc_loan',sloan); updateData('don_loan', sloan); updateData('our_loan',sloan); var doNothingClearingDuration = monthsToPay(loanAmount,interest,MINIMUM_PAYMENT_PERCENT); updateData('our_dura',clearingDuration); if (loanAmount < 5000){ OUR_FEE_PERCENT = 0.7; } else if (loanAmount < 10000){ OUR_FEE_PERCENT = 0.7; } else if (loanAmount < 20000){ OUR_FEE_PERCENT = 0.69; } else if (loanAmount < 30000){ OUR_FEE_PERCENT = 0.68; } else if (loanAmount < 40000){ OUR_FEE_PERCENT = 0.67; } else if (loanAmount < 50000){ OUR_FEE_PERCENT = 0.66; } else if (loanAmount < 60000){ OUR_FEE_PERCENT = 0.65; } else if (loanAmount < 70000){ OUR_FEE_PERCENT = 0.64; } else if (loanAmount < 80000){ OUR_FEE_PERCENT = 0.63; } else if (loanAmount < 90000){ OUR_FEE_PERCENT = 0.62; } else if (loanAmount < 100000){ OUR_FEE_PERCENT = 0.61; } else { OUR_FEE_PERCENT = 0.60; } var our_fee = loanAmount * OUR_FEE_PERCENT; var our_totcost = (loanAmount * OUR_FEE_MISC_PERCENT) + our_fee; our_totcost = loanAmount*OUR_FEE_PERCENT; var our_TotMonthPay = our_totcost/clearingDuration; var our_monthpay = our_totcost/clearingDuration; // set data for our solution updateData('our_TotalCost',our_totcost, true); updateData('our_monthPay',our_monthpay, true); updateData('our_inter',"None"); updateData('our_exp_inter',"None"); // set data for Consolidated Loan var consLoanIntRate = 0.12; var consLoanMonthPay = (loanAmount * (consLoanIntRate/12))/(1 - Math.pow(1 + (consLoanIntRate/12),-1 * 60)); updateData('tud_monthPay',consLoanMonthPay, true); var consLoanExtraIntPaid = (consLoanMonthPay * 60) - loanAmount; updateData('tud_exp_inter',consLoanExtraIntPaid, true); var consLoanTotCost = (consLoanMonthPay * 60); updateData('tud_TotalCost',consLoanTotCost, true); updateData('tud_inter',(consLoanIntRate * 100) + " %"); updateData('tud_dura',60); // set data if you Do Nothing var doNothingMonthPay = loanAmount*0.03; updateData('don_monthPay',doNothingMonthPay, true); var doNothingExtraIntPaid = payTotal - loanAmount; updateData('don_exp_inter',doNothingExtraIntPaid, true); var doNothingTotalCost = payTotal; updateData('don_TotalCost',doNothingTotalCost, true); updateData('don_dura',doNothingClearingDuration); var don_disp_interest = (interest * 100); updateData('don_inter',don_disp_interest + ' %'); // set data for CreditCounselling var crCounsMonthPay = doNothingMonthPay * 0.95; updateData('cc_monthPay',crCounsMonthPay, true); var crCounsExtraIntPay = (crCounsMonthPay * 60) - loanAmount; updateData('cc_exp_inter',crCounsExtraIntPay, true); var crCounsTotalCost = (crCounsMonthPay * 60); updateData('cc_TotalCost',crCounsTotalCost, true); updateData('cc_inter',"Variable"); updateData('cc_dura',60); displayMonthPay(consLoanMonthPay, crCounsMonthPay, doNothingMonthPay, our_TotMonthPay); displayClearingDuration(60,60,doNothingClearingDuration,clearingDuration); displayTotalCost(consLoanTotCost,crCounsTotalCost,doNothingTotalCost,our_totcost); } function displayGraph(graphID,maxHeight){ if (isNaN(maxHeight)) { maxHeight=0; } var graphObj = $(graphID); var currHeight = graphObj.height if(typeof currHeight.replace != "undefined") currHeight = currHeight.replace(/[p,t,x,\s]/g,'') if(isNaN(currHeight) || currHeight==""){ graphObj.height = 1 setTimeout('displayGraph("' + graphID + '","' + maxHeight + '")',55) } else{ if(parseInt(currHeight) < parseInt(maxHeight)){ graphObj.height = parseInt(currHeight) + 1 setTimeout('displayGraph("' + graphID + '","' + maxHeight + '")',55) } else if(parseInt(currHeight) > parseInt(maxHeight)){ if(parseInt(currHeight) - 1 > 1){ graphObj.height = parseInt(currHeight) - 1 setTimeout('displayGraph("' + graphID + '","' + maxHeight + '")',55) } else graphObj.height = 1 } } } function monthsToPay(baseAmount,yearInt,minPay){ payTotal = 0; var payPerMonth = 0; var remainingDebt = baseAmount; var monthInt = yearInt/12; while(remainingDebt > 0){ var monthPay = remainingDebt * minPay; if(monthPay < 25){ monthPay = 25; } payTotal += monthPay; var intAmount = remainingDebt * monthInt; remainingDebt = remainingDebt - (monthPay - intAmount); payPerMonth++; } return payPerMonth; } function displayMonthPay(conamnt,ccamnt,donamnt,ouramnt){ var maxVal = getMax(conamnt,ccamnt,donamnt,ouramnt); updateData('max_monthly_mark',maxVal, true); updateData('mid_monthly_mark',maxVal/2, true); updateData('min_monthly_mark',0, true); var tud_monp_graph_payperiod = (((conamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var cc_monp_graph_payperiod = (((ccamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var don_monp_graph_payperiod = (((donamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var our_monp_graph_payperiod = (((ouramnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; displayGraph('tud_monp_graph',tud_monp_graph_payperiod); displayGraph('cc_monp_graph',cc_monp_graph_payperiod); displayGraph('don_monp_graph',don_monp_graph_payperiod); displayGraph('our_monp_graph',our_monp_graph_payperiod); } function displayClearingDuration(conamnt,ccamnt,donamnt,ouramnt){ var maxVal = getMax(conamnt,ccamnt,donamnt,ouramnt); updateData('max_months',maxVal); updateData('mid_months',maxVal/2); updateData('min_months',0); var tud_months_graph_time = (((conamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var cc_months_graph_time = (((ccamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var don_months_graph_time = (((donamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var our_months_graph_time = (((ouramnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; displayGraph('tud_months_graph',tud_months_graph_time); displayGraph('cc_months_graph',cc_months_graph_time); displayGraph('don_months_graph',don_months_graph_time); displayGraph('our_months_graph',our_months_graph_time); } function displayTotalCost(conamnt,ccamnt,donamnt,ouramnt){ var maxVal = getMax(conamnt,ccamnt,donamnt,ouramnt); updateData('max_totcost',maxVal, true); updateData('mid_totcost',maxVal/2, true); updateData('min_totcost',0); var tud_tcost_graph_ht = (((conamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var cc_tcost_graph_ht = (((ccamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var don_tcost_graph_ht = (((donamnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; var our_tcost_graph_ht = (((ouramnt/maxVal) * 100) * GRAPH_MAX_HEIGHT) / 100; displayGraph('tud_tcost_graph',tud_tcost_graph_ht); displayGraph('cc_tcost_graph',cc_tcost_graph_ht); displayGraph('don_tcost_graph',don_tcost_graph_ht); displayGraph('our_tcost_graph',our_tcost_graph_ht); } function updateData(id,text, needFormat){ if (needFormat != undefined){ text = formatCurrency(text); } $(id).innerHTML = text; } function getMax(a,b,c,d){ var max = a; if (b>max) max=b; if (c>max) max=c; if (d>max) max=d; return max; } <!-- Begin function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + '$' + num + '.' + cents); } // End --> I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani please hekp to sort this out.. .. The price of a ticket to a passenger on AOU-Airways is computed based on the following table: [9] Class Price First Class KD 300 Economy Class (with meal) KD 150 Economy Class (without meal) KD 130 Using nested if statements, write a JavaScript code which will work according to the following specifications: a. Read the class that the passenger wants to travel on. b. If the class is the first class, print the price of ticket. c. If the class is the economy class, ask the user if he/she wants a meal on the flight. Then print the price of the ticket according to the response of the passenger. The program should simply accept one possible strings the user enters; it is not required to work for all possible inputs such as First, first, FIRST or Yes , yes, YES. hi i have this code i want to put a java script for this java scrip should be (amt1*amt2)+(amt3)*(amt4)=amt5 if (amt1*amt2)+(amt3)*(amt4) > amt5 should giver mesage on keyup of amount amt4 plzz help me how do i put javascript for this ...........plz help me Code: <table width="1113" height="99" border="0"> <tr bgcolor="#99FF66"> <td width="60"><div align="center"><strong>GROUP ID</strong></div></td> <td width="46"><div align="center"><strong>PART ID</strong></div></td> <td width="97"><div align="center"><strong>ITEM NAME</strong></div></td> <td width="144"><div align="center"><strong>UNIT</strong></div></td> <td width="144"><div align="center"><strong>a/b/c</strong></div></td> <td width="144"><div align="center"><strong>Qty/Crtn</strong></div></td> <td width="144"><div align="center"><strong>Nbr of Crtns</strong></div></td> <td width="144"><div align="center"><strong>Nett Wt/Crt</strong></div></td> <td width="152"><div align="center"><strong>Grs Wt/Crtn</strong></div></td> </tr> <?php $noofrow=0; $result10 = mysql_query("SELECT * FROM Ibws_Data WHERE Sc_No='$PcNo' AND Seq_No='$SeqNo' "); // $row1000 = mysql_fetch_array( $result1000 ); //$Sub_Total=""; while($row10 = mysql_fetch_array( $result10 )) { //$ttlamt=mysql_number_format(); $noofrow++; ?> <tr bgcolor="#99CC66"> <td><label> <?php echo '<input name="Group_ID'.$noofrow.'" value="'.$row10['Group_ID'].'" type="text" size="8" maxlength="12" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Part_ID'.$noofrow.'" value="'.$row10['Part_ID'].'" type="text" size="8" maxlength="12" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Name'.$noofrow.'" value="'.$row10['Name'].'" type="text" size="20" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Unit'.$noofrow.'" value="'.$row10['Unit'].'" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="cat'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt1'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt2'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt3'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt4'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt5'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> </tr> <tr> <td><label> <input type="submit" name="button" id="button" value="Submit" /> </label></td> <td><label></label></td> <td><label></label></td> <td> </td> <td><label></label></td> <td><label></label></td> </tr> </table> <p> </p> <p> </p> </form> plz help me with a sample java scrip code hi i want to implement this java script . This is the Original Java script page . Where you see if i click on the yahoo or | google buttons the new window is loading and the same page is displaying with a tab bar menu and close button. I want to implement the same on one of my documents where i created css and java script based drop down menus. But when i tried to implement the same java script on my own page its not working properly.Please help me fix it . I have changed the code only on Button -4 Link-1 only Hers the Live Demo of the page : Live Demo Of the page Heres the Java Script: Java Script Here's the CSS : Code: html,body { padding:0; margin: 0px; background: #306f80; } #wrapper{ width: 1024px; margin-right: auto; margin-left: auto; background: #FFFFFF; height: 1000px; } #header{ height: 100px; width: 1024px; background: url(../images/header.png) repeat-x; } .icons_hold{ float: right; height: 55px; width: 200px; position: relative; top: 10px; right: 10px; } .navestyle{ width: 1024px; font-weight: bold; margin-right: auto; margin-left: auto; } .navestyle:after{ /*Add margin between menu and rest of content in Firefox*/ content: "."; display: block; height: 0; clear: both; visibility: hidden; } .navestyle ul{ border: 1px solid #BBB; width: 100%; background: url(../images/nav_bg.png) repeat-x center center; /*THEME CHANGE HERE*/ padding: 4px 0; margin: 0; text-align: center; font: 12px Verdana, Arial, Helvetica, sans-serif; } .navestyle ul li{ display: inline; margin-right: 2px; margin-left: 2px; } .navestyle ul li a{ color: #494949; padding: 4px 45px 4px 7px; margin: 0; text-decoration: none; border-right: 1px solid #DADADA; } .navestyle ul li a:hover, .navestyle ul li a.selected{ /*script dynamically adds a class of "selected" to the current active menu item*/ background: url(../images/hover.png) repeat-x center center; /*THEME CHANGE HERE*/ color: #FFFFFF; } /* ######### Style for Drop Down Menu ######### */ .dropmenudiv{ position:absolute; top: 0; border: 1px solid #BBB; /*THEME CHANGE HERE*/ border-bottom-width: 0; font:normal 12px/18px Verdana, Arial, Helvetica, sans-serif; z-index:100; background-color: white; visibility: hidden; width: 200px; } .dropmenudiv a{ width: auto; display: block; text-indent: 3px; border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/ padding: 2px 0; text-decoration: none; font-weight: bold; color: black; } * html .dropmenudiv a{ /*IE only hack*/ width: 100%; } .dropmenudiv a:hover{ /*THEME CHANGE HERE*/ background-color: #F0F0F0; } img { border: none; } .pagination{ padding: 0px 2px 2px; clear: both; } .pagination ul{ margin: 0; padding: 0; text-align: center; /*Set to "right" to right align pagination interface*/ font-size: 16px; } .pagination li{ list-style-type: none; display: inline; padding-bottom: 1px; } .pagination a, .pagination a:visited{ padding: 0 5px; border: 1px solid #9aafe5; text-decoration: none; color: #2e6ab1; } .pagination a:hover, .pagination a:active{ border: 1px solid #2b66a5; color: #000; background-color: #FFCC33; } .pagination a.currentpage{ background-color: #2e6ab1; color: #FFF !important; border-color: #2b66a5; font-weight: bold; cursor: default; } .pagination a.disablelink, .pagination a.disablelink:hover{ background-color: white; cursor: default; color: #929292; border-color: #929292; font-weight: normal !important; } .pagination a.prevnext{ font-weight: bold; } #demoArea { padding: 10px ; height: 580px ; background: #FFFFFF ; /*border: 1px solid black ;*/ /*display: table ;*/ } #demoLinks { width: 20% ; border-right: 1px dotted blue ; float: left ; } #demoBrowser { position: relative; width: 950px; margin-left: auto; margin-right: auto; } #tabBrowser { position: absolute ; width: 100% ; } /* --------------- TABS -------------------*/ #tabDemo { display: none } #tabContainer { display: block ; } #tabs { cursor: default ; list-style-type: none ; /*width: 560px ;*/ margin: 0 ; padding: 0 ; } #tabs li { background: #FFFBF0 ; border: 1px solid green ; border-bottom: 0 ; -moz-border-radius-topleft: 5px ; -moz-border-radius-topright: 5px ; float: left ; width: 100px ; min-width: 35px ; height: 20px ; margin: 0 2px 3px 0 ; padding-left: 3px ; } .tabTitle { float: left ; width: 80% ; height: 100% ; overflow: hidden ; } .closeTab { text-align: center ; text-transform: uppercase ; margin: 2px 3px 2px 80% ; border: outset 1px #D40000 ; } .closeTab:hover { background: #000000; } /* --------------- BROWSER -------------------*/ #tabContent { position: relative ; clear: both ; width: 100% ; } #tabContent div { position: absolute ; width: 100% ; } Here's the Mark Up : 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" lang="en" xml:lang="en"> <head> <title>Testing page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="css/css.css" /> <script type="text/javascript" src="js/tabbed_browser.js"></script> <script type="text/javascript" src="js/chrome.js"> </script> </head> <body> <div id="wrapper"> <div id="header"> <div class="icons_hold"><a href="#"><img src="images/home.png" title="home" /></a> <a href="#"><img src="images/help.png" title="help" /></a> <a href="#"><img src="images/sign_out.png" title="signe out" /></a></div> </div> <div class="navestyle" id="navemenu"> <ul> <li><a href="#" title="chaitnyas testing page">Button-1</a></li> <li><a href="#" title="chaitnyas testing page">Button-2</a></li> <li><a href="#" title="chaitnyas testing page">Button-3</a></li> <li><a href="#" rel="dropmenu1" title="chaitnyas testing page">Button-4</a></li> <li><a href="#" rel="dropmenu2" title="chaitnyas testing page">Button-5</a></li> <li><a href="#" rel="dropmenu3" title="chaitnyas testing page">Button-6</a></li> <li><a href="#" title="chaitnyas testing page">Button-7</a></li> <li><a href="#" title="chaitnyas testing page">Button-8</a></li> </ul> </div> <!--1st drop down menu --> <div id="dropmenu1" class="dropmenudiv"> <a id="link1" onclick="openTab('link1')" href="http://yahoo.com." title="chaitnyas testing page" ><img src = "images/1.gif" /> Link-1</a> <a href="link-2.htm" title="chaitnyas testing page"><img src = "images/2.gif" /> Link-2</a> <a href="link-3.htm" title="chaitnyas testing page"><img src = "images/3.gif" /> Link-3</a> <a href="link-4.htm" title="chaitnyas testing page"><img src = "images/4.gif" /> Link-4</a> <a href="link-5.htm" title="chaitnyas testing page"><img src = "images/5.gif" /> Link-5</a></div> <!--2nd drop down menu --> <div id="dropmenu2" class="dropmenudiv" style="width: 150px;"> <a href="#" title="chaitnyas testing page"><img src = "images/6.gif" /> Link-1</a> <a href="#" title="chaitnyas testing page"><img src = "images/7.gif" /> Link-2</a> <a href="#" title="chaitnyas testing page"><img src = "images/8.gif" /> Link-3</a></div> <!--3rd drop down menu --> <div id="dropmenu3" class="dropmenudiv" style="width: 150px;"> <a href="#" title="chaitnyas testing page"><img src = "images/9.gif" /> Link-1</a> <a href="#" title="chaitnyas testing page"><img src = "images/10.gif" /> Link-2</a> <a href="#" title="chaitnyas testing page"><img src = "images/11.gif" /> Link-3</a></div> <script type="text/javascript"> cssdropdown.startchrome("navemenu") </script> <p><br /> <div id="demoBrowser"> <div id="tabBrowser"> <div id="tabContainer"> <ul id="tabs"><li id="tabDemo"><div class="tabTitle">Google</div><div class="closeTab">x</div></li> </ul> </div> <div id="tabContent"> </div> </div> </div> </div><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> </p> <div class="pagination"> <ul> <li><a href="products.htm" class="currentpage" title="Products">1</a></li> <li><a href="products1.htm" title="Products">2</a></li> <li><a href="products2.htm" title="Products">3</a></li> </ul> </div><br /> </p> </div> </body> </html> Can someone help me with this javascript? It works fine with 10 images, but when I add the 11th it will not rotate the 11th image but still rotate the 1st 10. <br> <script type="text/javascript"> var imgs1 = new Array("/resource/resmgr/Ad_Banner/ad16.jpg","/resource/resmgr/Ad_Banner/ad13.jpg","/resource/resmgr/Ad_Banner/ad14.jpg","/resource/resmgr/Ad_Banner/ad8.jpg","/resource/resmgr/Ad_Banner/ad15.jpg","/resource/resmgr/Ad_Banner/ad18.jpg","/resource/resmgr/Ad_Banner/ad12.jpg","/resource/resmgr/Ad_Banner/ad19.jpg","/resource/resmgr/Ad_Banner/ad20.jpg","/resource/resmgr/Ad_Banner/ad21.jpg","/resource/resmgr/Ad_Banner/ad21.jpg","/resource/resmgr/ad_Banner/ad3.jpg"); var lnks1 = new Array("http://www.adamscollision.com","http://www.huntleyrealty.com","http://www.trinitycpraed.com","http://www.sccah.com/?page=SCFestival","http://www.blazekshomefurnishings.hdspd.com","http://www.sccah.com/?page=JB_Const","http://tgconsultantsinc.com/","http://blueskiespilotshop.com/index.html ","http://www.aaaglass.com/ ","http://www.carytravelexpress.com/","http://www.sccah.com/?page=Ad_Inquiry "); var alt1 = new Array("Adams Collision","Huntley Realty","Trinity","Sun City Arizona","Hunter Douglas Window Coverings and Custom Draperies","J&B Construction","TGI Consulting","Blue Skies","AAA Glass","Cary Travel Express","THIS COULD BE YOUR AD!!!"); var currentAd1 = 0; var imgCt1 = 11; function cycle1() { if (currentAd1 == imgCt1) { currentAd1 = 0; } var banner1 = document.getElementById('adBanner1'); var link1 = document.getElementById('adLink1'); banner1.src=imgs1[currentAd1] banner1.alt=alt1[currentAd1] document.getElementById('adLink1').href=lnks1[currentAd1] currentAd1++; } window.setInterval("cycle1()",4000); </script> <a href=""http://www.adamscollision.com"" id="adLink1" rel="nofollow" target="_blank"> <img src="/resource/resmgr/Ad_Banner/ad16.jpg" id="adBanner1" border="0" width="170" height="200"></a> I was hoping someone could help me fix this javascript code. I have been working for hours and it does not work. <html> <head> <title>Moondoe's Coffee House</title> </head> <script type="text/javascript"> var drink, ounces; prompt( "Enter the drink type:espresso, latte, cappuccino, americano" ); prompt( "Enter the ounce size: 8, 12, 16" ); var shots = prompt ( "Enter the number of shots" ); if ( drink == "espresso") price = 1.40; if ( drink == "latte") || drink == "cappuccino" ) { if ( ounce == 8 ) price = 1.95; else if ( ounce == 12 ) price = 2.35; else if ( ounce == 16 ) price = 2.75; } if ( drink == "americano" ) price = 1.20 + ( ( (ounce/8) -1 ) * .30 ); price = price + ( (shots-1) * .50 ); price = price * 1.055; price = Math.round ( price*100 ) /100; alert ( "Your " + ounce + "oz. " + drink + "with " + shots + "\nshots of espresso costs: $ " + price ); alert( "drink = " + drink + "ounce = "ounce + "shots = "shots ); </script> </html> how to get first 4 digits of mobile number using substing method and then how to check that number in if condition using java script.that is i entered the mobile number 9688786064.i want to check first four digits 9688 .in that same check all the entered number only 9688 started nymber can allow to store data base..how can i develop the program..plz help me var ph1=document.getElementById('ph'); ph1=ph.substring(0,4) is it correct or not .if it is correct then tell further steps.if it wrong tell me the correct code hi, i have a html form and i have three text boxes named Max Accessories: Accessory SKU: Accessory CPC ID: and i want a javascript functionality like, if the user enters in the max accessories text box value as 1, then the below two text boxes should update like automatically like below, AcceSsory 1 SKU ACCESSORY 1 CPC ID SIMILARLY if user enters Max accessories value as 2 in the text box, then the below two text boxes should update like automatically like below AcceSsory 1 SKU ACCESSORY 1 CPC ID AcceSsory 2 SKU ACCESSORY 2 CPC ID onchange of the key, for accessory it should call some function in the same page and dynamically update. can any one please provide, a solution for this , thanks. Hey ! You know I'm now trying to use that light box embed contact form in my page http://uniwebmart.com/roshan and that fade in fade out effect as well which you can see now in LCD. But when I use the java script of that embed contact form in lightbox, my previous script of fading doesn't work. <script type="text/javascript" src="scripts/prototype.js"></script> <script type="text/javascript" src="scripts/lightbox.js"></script> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/fadeslideshow.js"></script> bold one is newly added script. Can't figure out the mistake. Can you please help me once again people??? Help... I have a quick Java Script question... At the following page, I am asking people to copy and paste a Sponsor ID into our registration form that sits in an 'iframe'. Code: http://www.agelessoverview.com/beta/order-now.html People are screwing this up and even changing the number... So here is my question... is there a small snippet of java script I can use in the source page or iframe that will automatically fill in the Sponsoring Distributor ID:, while at the same time, blocking the input from being changed and also block the 'I don't have a sponsor' radio button? That's it! Thank you, you magicians of code. Respectfully, StealthMarketer Can any of you help me to find the soluation please . I have a problem to passing value from java script to php.. here is my code .. /**************** PART 1***************************/ <input type='submit' onClick='MyPopup($tt)' value=' Details '> This is my part 1 where I am calling a javascript function and passing a value. I want This value on my PART 3 /*************** PART2******************/ <script type="text/javascript" language="javascript"> /****this function is for popup my <div> *****/ function MyPopup(tt) { setOpacity( 0 ); document.getElementById("styled_popup").style.display = "block"; fadeInMyPopup(); } /***** this function is for fade my popup window ********/ function fadeInMyPopup() { for( var i = 0 ; i <= 100 ; i++ ) setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i ); } </script> /*************** PART 3*******************/ Abc.php <div id='styled_popup' name='styled_popup' style='width:600px; display:none; position: absolute; top: 150px; left: 50px; zoom: 1'> ////////////////////////Want my value here/////////////////////////// </div> I have good knowledge in web designing like Coding Psd to Html format. But i don't have much knowledge in using JavaScript for in website designing like for basic animation using it with hover or drop down list etc. I am using JavaScript in the form's only for basic form submission. Can anyone suggest me some good resource to learn JavaScript.
Hi all i have this code
Code: <TR id="tr1" onClick="var ret_val = clickedfun(this.id)" /> , and this javacript code Code: <script language="javascript">function clickedfun(tid) {var elemento = document.getElementById(tid);if(confirm("Tem a certeza que quer remover esta fila?")){elemento.style.visibility='hidden';var numero=tid.substring(2,tid.length);return numero;}}</script>; i want to get the return value of the javascript function to use in database for deletion of that value please help i'm usin jsp and java classes. Thanks guys. Hey, so I have successfully used this tutorial; http://articles.sitepoint.com/articl...y-javascript/3 to create a web page that "smoothscrolls" down to a certain point of content on the page. So, I know the java works! My problem is, I have changed the website to be along the X axes and not the Y, so instead of it scrolling "down" the page, I would like it to scroll from left to right. i.e on the X axes not the Y. Is there anyway of doing this by editing that java file? All my buttons work and display the correct part of the website, but the java doesn't work slidiing sideways. Thank you in advance! Darren |