JavaScript - Need To Figure How This Thing Will Work
when i try to run this it always says INPUT FROM A FILE.
a file can have more than one birthday at it will be output also to a file. sorry for my bad english Code: import java.util.*; public class ZodiacSign { public static void main(String[] args) { String sign=""; String element=""; String chineseSign=""; int month, day,year; Scanner c = new Scanner (System.in); System.out.println("Enter day(1-31): "); day = c.nextInt(); System.out.println("Enter month(1-12): "); month = c.nextInt(); System.out.println("Enter year: "); year = c.nextInt(); if((month == 1) && (day <= 20) || (month == 12) && (day >= 22)) { sign = "Capricorn"; } else if((month == 1) || (month == 2) && (day <= 19)) { sign = "Aquarius"; } else if((month == 2) || (month == 3) && (day <= 20)) { sign = "Pisces"; } else if((month == 3) || (month == 4) && (day <= 19)) { sign = "Aries"; } else if((month == 4) || (month == 5) && (day <= 21)) { sign = "Taurus"; } else if((month == 5) || (month == 6) && (day <= 21)) { sign = "Gemini"; } else if((month == 6) || (month == 7) && (day <= 23)) { sign = "Cancer"; } else if((month == 7) || (month == 8) && (day <= 23)) { sign = "Leo"; } else if((month == 8) || (month == 9) && (day <= 23)) { sign = "Virgo"; } else if((month == 9) || (month == 10) && (day <= 23)) { sign = "Libra"; } else if((month == 10) || (month == 11) && (day <= 22)) { sign = "Scorpio"; } else if(month == 12) { sign = "Sagittarius"; } if((sign.equals("Aries"))||(sign.equals("Leo"))||(sign.equals("Sagittarius"))){ element="Fire"; } else if((sign.equals("Taurus"))||(sign.equals("Virgo"))||(sign.equals("Capricorn"))){ element="Earth"; } else if((sign.equals("Gemini"))||(sign.equals("Libra"))||(sign.equals("Aquarius"))){ element="Air"; } else if((sign.equals("Cancer"))||(sign.equals("Scorpio"))||(sign.equals("Pisces"))){ element="Water"; } int x = (1997 - year) % 12; if ((x == 1) || (x == -11)){ chineseSign="Rat"; } else{ if (x == 0){ chineseSign="Ox"; } else{ if ((x == 11) || (x == -1)){ chineseSign="Tiger"; } else{ if ((x == 10) || (x == -2)){ chineseSign="Rabbit"; } else{ if ((x == 9) || (x == -3)){ chineseSign="Dragon"; } else{ if ((x == 8) || (x == -4)){ chineseSign="Snake"; } else{ if ((x == 7) || (x == -5)){ chineseSign="Horse"; } else{ if ((x == 6) || (x == -6)){ chineseSign="Sheep"; } else{ if ((x == 5) || (x == -7)){ chineseSign="Monkey"; } else{ if ((x == 4) || (x == -8)){ chineseSign="Chicken"; } else{ if ((x == 3) || (x == -9)){ chineseSign="Dog"; } else{ if ((x == 2) || (x == -10)){ chineseSign="Pig"; } } } } } } } } } } } } System.out.println("Your Zodiac sign is "+sign+"."); System.out.println("Chinese Zodiac is: "+chineseSign+"."); System.out.println("Element is "+element+"."); } } Similar TutorialsThis is for an assignment that I am working on, have figured out most of the code already, I am just having a hard time getting one question. The question is "in the defineMarquee function it says for every item in the marqueeTxt array, store the value of the top style from the CSS style sheet in a variable named topValue. (Hint: To extract the values from the style sheet , use object detection to determine the calculated CSS style value.) After you have calculated a vale for the topValue variable, store that value in the top style property for the current item in the marqueeTxt array." In truth I really don't understand what it is asking, so if someone could help me out with some detail or what I should be looking for. Here is the code i have so far: Code: var timeID; var marqueeTxt = new Array(); var marqueeOff = true; window.onload = defineMarquee; function defineMarquee(){ var allElems = document.getElementsByTagName("*"); for (var i=0; i<allElems.length; i++){ if (allElems[i].className == "marqueeTxt") marqueeTxt.push(allElems[i]); } for (i = 0; i < marqueeTxt.length; i++) { if (window.getComputedStyle) { var topValue = marqueeTxt[i].currentStyle["top"]; } marqueeTxt[0].style.top = topValue + "px"; } document.getElementById("startMarquee").onclick = startMarquee; document.getElementById("stopMarquee").onclick = stopMarquee; } function startMarquee(){ if(marqueeOff == true){ timeID = setInterval("moveText()",50); marqueeOff = false; } } function stopMarquee(){ clearInterval(timeID); marqueeOff = true; } function moveText(){ for(var i=0; i<marqueeTxt.length; i++){ topPos = parseInt(marqueeTxt[i].style.top); if (topPos < -110){ topPos = 700; }else{ topPos = topPos - 1; } marqueeTxt[i].style.top = topPos + "px"; } } I have no idea if that's the only problem but I just can't get the marquee to work and I think that is part of the problem . Thank you in advance for and help. I need to know how to subtract a number which selecting an option from checkboxes. As seen in picture below. Basically you have a maximum of 10 stats to select. If you select say 3 Strength, I need the 10 to change to a 7, and it changes on each new value the select boxes have. So when they equal 10, it'd show a red 0 remaining. I'd prefer some way of not allowing more than a maximum of 10 from being selected, but don't know if thats even possible. Thanks for any help! Code: <h2>Starter Stats</h2> <ul> <li>You have <b>10</b> stats remaining.</li><br /> <li> <table width="75%"> <tr><td> <b>Focus</b></td><td><select name="focus"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Attack</b></td><td><select name="attack"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Defense</b></td><td><select name="defense"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Dexterity</b></td><td><select name="dexterity"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Magic Defense</b></td><td><select name="magicdefense"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> </table> HI evey one I want to make a vote music web site , some thing like this : http://www.pmctop20.com/ we can drag each of the items in the left panel and drag it to the vote rows . How can I do so? It's a jquery script Thanks I know very little JavaScript (I can modify a script slightly, but I can't write one), so I am asking for your help. I want to place a textarea on a web page. This textarea would have attributes to make it so that if you pressed "i", it would come out as "c", or if you pressed "]" it would appear as "=", and so on. (If you're wondering, I want to make it work like the Dvorak keyboard layout). I also would like a button to copy the text in the textarea to the clipboard. Thank you in advance for your help! Jordon OMG, Check out the background on this site... http://paulirish.com/ how would I even start to rip that for use on my own site? I'll pay someone $15 on paypal if they can make a css and js file that I can just link too and have this background
How could a make a html button that each time your press it it does a new things?
Code: var c=0; var i=0; function timedCount() { document.getElementById('txt').innerHTML=c; c++; setTimeout("timedCount()",500); } function expand() { while (i<=10) { timedCount(); i++; } } For some reason the innerHTML number starts at 10 because of the while. I want it to start from 0 and stop when at 10... How would I clean up this code? it looks so ugly, would I put it in a for loop and make it loop through and set the rand2, rand3, rand4 = place... there so there is a lot less lines of code(which is what I want) I need a cleaner way to do this, so it isn't so much space. Can someone help? there needs to be different variables because I need the random to be different for each, so rand2 = different random value than rand3. var place = [74,111,148,185,222,259,296,333,370]; var random = [rand,rand2,rand3,rand4,rand5,rand6,rand7,rand8,rand9]; var rand = place[Math.floor(Math.random()*place.length)]; var rand2 = place[Math.floor(Math.random()*place.length)]; var rand3 = place[Math.floor(Math.random()*place.length)]; var rand4 = place[Math.floor(Math.random()*place.length)]; var rand5 = place[Math.floor(Math.random()*place.length)]; var rand6 = place[Math.floor(Math.random()*place.length)]; var rand7 = place[Math.floor(Math.random()*place.length)]; var rand8 = place[Math.floor(Math.random()*place.length)]; var rand9 = place[Math.floor(Math.random()*place.length)]; var newrand = place[Math.floor(Math.random()*place.length)]; var newrand1 = place[Math.floor(Math.random()*place.length)]; var newrand2 = place[Math.floor(Math.random()*place.length)]; var newrand3 = place[Math.floor(Math.random()*place.length)]; var newrand4 = place[Math.floor(Math.random()*place.length)]; var newrand5 = place[Math.floor(Math.random()*place.length)]; var newrand6 = place[Math.floor(Math.random()*place.length)]; var newrand7 = place[Math.floor(Math.random()*place.length)]; var newrand8 = place[Math.floor(Math.random()*place.length)]; var newrand9 = place[Math.floor(Math.random()*place.length)]; var old = place[Math.floor(Math.random()*place.length)]; var old1 = place[Math.floor(Math.random()*place.length)]; var old2 = place[Math.floor(Math.random()*place.length)]; var old3 = place[Math.floor(Math.random()*place.length)]; var old4 = place[Math.floor(Math.random()*place.length)]; var old5 = place[Math.floor(Math.random()*place.length)]; var old6 = place[Math.floor(Math.random()*place.length)]; var old7 = place[Math.floor(Math.random()*place.length)]; var old8 = place[Math.floor(Math.random()*place.length)]; var old9 = place[Math.floor(Math.random()*place.length)]; So I am working on a project to take an integer that the user gives, and then get all the squares and cubes of all the numbers before that to the number given. It displays it in a text area. Maybe I am just lost for the moment, but It just prints the number that I give with the square root and cube instead of starting from 1, and ended on the integer I give. Code: var square_cube = function (){//This f var number = parseInt($("maxbase").value); for (var i=1;i <= number;i++) { var squ = Math.pow(i,2); } var j; for (j=1;j<=number;j++) { var cub = Math.pow(j,3); } var message = i-1 + " " +squ+ " " +cub; $("powers").value = message; } <% content_for :scripts do %> <script type="text/javascript"> $(document).ready(function() { $('.list-tag li a').click(function() { division_id = $(this).attr('id'); division_title = $(this).text(); org_id = <%= @current_org.id %>; org_type = "<%= @current_org.class.to_s %>"; divisionSelected(division_id, division_title, org_id, org_type); return false; }); I have a javascript platform that isn't working correctly. IE 8 is complaining about the line in red, and IE 7 is giving me a syntax error for line in green. Anyone have any advice or suggestions? I dont think anyone can write a code for this because i cant find it anywhere.. I keep trying to write javascript but i just cant grasp it.... and my website is really falling behind.. basically THIS SITE'S total price section and the whole construct of the ability to have everything listed like that and work the way it does is what i want... if i could get the simple version of the code used to make that happen i could continue on and write all the rest... just variables and less than i and document.getWhatever is confusing the crap outta me... but like i said earlier i dont expect anyone here can help me so its alright... but if anyone actually can ILL LOVE YOU FOREVER!!!! Hey everyone. I am making a form with some math functions in it. There is one dropdown where depending on the users selection, the formula should be different. Here is the script so far: Code: <script language="javascript"> function calc(form) { // set variables from input names length= eval(form.length.value) cope = eval(form.cope.value) bevel = eval(form.bevel.value) offset1 = eval(form.offset1.value) // formula calculation = (length-cope) + (offset1 / 2) // display calculation in input form.cut.value = calculation } </script> So what I want is: if bevel=B1 and offset1 > 5, then the formula to use will be "calculation = (length-cope) + (offset1 / 2)" else, it will be "calculation = (length-cope)". I have tried to write this in a simple if.. but obviously my javascript skills are lacking, because the form just doesnt do any calculations at all. How do I go about this? Thanks! What in the world is wrong with this? I have been looking at it for hours. Code: $.ajax({ url: "wifitos.html", type: "GET", dataType: "html", error: function(){ $("#loading").html("Error Loading Site. Try again later.");}, beforeSend: function(){ $("#loading").show("fast");}, complete: function(){ $("#loading").hide("fast");}, success: function(html){ $("#panel_content").show("slow"); $("#panel_content").html(html); } }); All the HTML tags are right. It shows the loading properly, but does not return an error and just says loading forever without loading wifitos.html. Help appreciated! FIXED! DON'T REPLY TO THIS THREAD: After hours of trying to figure this out, I find it 10 sec after I post this thread. Go figure. It was because I had a return false before the ajax. Please see the "watching eyes" next to the search box at the top of: http://www.burton.com I am looking to recreate a similar effect for a project, and I cannot figure out what script is running this. I can see there is some CSS and JS associated with this file but I cannot seem to figure out how it works. It seems to be done using x,y coordinates. Any help would be greatly appreciated. Thank you in advance, Jim All, I have searched and experimented for quite some time to figure out how to read the return value from a function and have some sort of simple error that I suspect all of you will see immediately. I have tried to return a boolean, a string and a number to use a decision variable... Can one of you look at the code below and tell me what I am missing? (I am running this code a a workstation without any web server due to employer restrictions but I am having the same trouble on my development server ...) (I am trying to make a reusable function that will read the URL and let me know if it has a word in it so I can perform some logic.) Any help would be greatly appreciated... Thanks... <html> <head> <title> JS Test 1</title> <script type="text/javascript"> function OnBodyLoadLogic(){ // UrlHandler(); a test peice of code... UrlHandlerBoolean(); if (UrlHandlerBoolean() == true) { alert("This has the value some URL in the URL"); } else { alert("some is not in the URL"); } } function UrlHandler(){ var urlValue = (window.location.host); var urlValueLowerCase = urlValue.toLowerCase(); if (urlValueLowerCase.indexOf("some URL") != -1) { alert("This has the value some URL in the URL"); } else{ alert("some is not in the URL"); } } function UrlHandlerBoolean(){ var urlValue = (window.location.host); var urlValueLowerCase = urlValue.toLowerCase(); if (urlValueLowerCase.indexOf("some URL") != -1) { return true; } else{ return false; } } function load() { alert("Page is loaded"); } </script> </head> <body onload="OnBodyLoadLogic()"> <h3> JS Return Value</h3> <p> This the beginning of the Page. </p> <div> A Test Div <span id="ReturnValueDisplay" >Initial Value</span> </div> </body> </html> Need help with the Script below. I got my radio buttons working, however...the rest of my form/webpage now won't appear. Advice? Please. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!-- InstanceBegin template="/Templates/2009-fs2-ochdes.dwt" codeOutsideHTMLIsLocked="false" --> <!--#include virtual="/global/admin/2009-fs2-site-configuration.shtml" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title></title> <!-- InstanceEndEditable --> <!--#include virtual="/global/ssi/2009-fs2-meta-details.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-meta-standard.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-meta-scripts.shtml" --> <!-- InstanceBeginEditable name="head" --> <script type="text/javascript"> if (window.addEventListener) window.addEventListener('load',init, true); else window.attachEvent('onload',init); function init() { inputs=document.forms.form1.getElementsByTagName('input'); for(i=0;i<inputs.length;i++) if(inputs[i].type.toLowerCase()=='radio') { thisOne = inputs[i]; radio_buttons.push(thisOne); thisOne.onclick=check_visibility; } fieldsets = document.forms.form1.getElementsByTagName('fieldset'); check_visibility(); } function check_visibility() { for(f=0;f<fieldsets.length;f++) { thisFieldset=fieldsets[f]; if(thisFieldset.id==root_fieldset)checkFieldsets.push(thisFieldset); else thisFieldset.style.display="none"; } do { checkFieldset=checkFieldsets.pop();//get an item to check if(typeof checkFieldset=='undefined') continue; inputs=checkFieldset.getElementsByTagName('input'); if(inputs.count==0) continue;//no inputs to check for(i=0;i<inputs.length;i++) { if(inputs[i].type.toLowerCase()!='radio') continue; thisRadio=inputs[i]; if(!thisRadio.checked) continue; //its a radio and its selected! dependants=visibility_dependancies[thisRadio.id]; if(typeof dependants=='undefined') continue; if(dependants.length==0) continue; for(d=0; d<dependants.length;d++) { newlyVisibleFieldset=document.getElementById(dependants[d]); checkFieldsets.push(newlyVisibleFieldset); newlyVisibleFieldset.style.display='block'; } } } while (checkFieldsets.length>0) } var radio_buttons = new Array(); var fieldsets = new Array(); var root_fieldset = 'Facility_Location_set'; var checkFieldsets = new Array(); var visibility_dependancies={ 'Facility_Location_BFR':new Array('BFR_type_set'), 'Facility_Location_BPAS':new Array('BPAS_type_set'), 'Facility_Location_CRES':new Array('CRES_type_set'), 'Facility_Location_GRLD':new Array('GRLD_type_set'), 'Facility_Location_LKMT':new Array('LKMT_type_set'), 'Facility_Location_PAU':new Array('PAU_type_set'), 'Facility_Location_RAC':new Array('RAC_type_set'), 'Facility_Location_SIS':new Array('SIS_type_set') }; </script> <style> fieldset{float:left; margin:0 2px;} label{padding-left:5px;} </style> <style type="text/css"> #TableBorder { border: thin solid #000; } </style> <!-- InstanceEndEditable --> </head> <body> <!--#include virtual="/global/ssi/2009-fs2-accessibility.shtml" --> <div id="page-wrapper"> <!--#include virtual="/global/ssi/2009-fs2-masthead.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-spotlight-navigation.shtml" --> <div id="sidebar-wrapper" class="noprint"> <!--#include virtual="/global/ssi/2009-fs2-site-navigation.shtml" --> </div><!-- CLOSE sidebar-wrapper --> <div id="content-wrapper"> <!--#include virtual="/global/ssi/2009-fs2-contribute1.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-breadcrumb.shtml" --> <!-- InstanceBeginEditable name="content" --> <h1>Report A Facility Maintenance Problem</h1> <!--#if expr="$QUERY_STRING = 'thankyou'" --> <h2>Thank You!</h2> <p>Thank you for reporting a Facility Maintenance Problem. </p> <!--#else --> <div id="contactus"> <form name="form1" id="form1" method="post" action="<!--#echo var='sitescripts' -->email-building-maint.php" /> <div id="emaildetails"> <input type="hidden" name="recipient_cc" value="cc" /> <input type="hidden" name="redirect" value="http://fsweb-ochdes.r6.fs.fed.us/eng/facilities/facility-maintenance-reporting/index.shtml?thankyou" /> <input type="hidden" name="required" value="Name,Phone_Number,email,recipient" /> <input type="hidden" name="subject" value="Facility Maintenance Problem Report" /> </div> <p><strong>* Fields with an asterisk are required</strong></p> <fieldset> <legend>Your Contact Information</legend> <dl> <dt><label for="Name">Your Name *</label></dt> <dd><input class="inputtext" type="text" id="Name" name="Name" /></dd> <dt><label for="Phone_Number">Your Telephone Number *</label></dt> <dd><input class="inputtext" type="text" name="Phone_Number" id="Phone_Number" /></dd> <dt><label for="email">Your Email Address *</label></dt> <dd><input class="inputtext" type="text" name="email" id="email" /></dd> <dt><label for="File_Location">Supporting Documents</label></dt> <p>If you have any supporting documents or shape files, please provide a file path to where it is stored on the network:</p> <dd><input class="inputtext" type="text" name="File_Location" id="File_Location" /></dd> </dl> <p><strong>Privacy Advisory:</strong> Your personal identifying information is being requested. We need this identifying information so that we can provide what you requested, and/or to respond to your comments. Generally, personal identifying information is destroyed after we fill your request. If you do not provide the requested personal information, we will be unable to respond directly to your request or comment.</p> </fieldset> <fieldset> <legend>Facility Site</legend> <p>Please provide the Facility Site:</p> <dl> <dt><label for="recipient">Facility Site*</label></dt> <dd><select class="inputselect" name="recipient" id="recipient"> <option value="" selected="selected">Select One...</option> <option value="bfr">Bend Fort Rock</option> <option value="bpas">Bend Pine Admin. Site</option> <option value="crescent">Crescent</option> <option value="GRLD">Crooked River National Grassland</option> <option value="LKMT">Lookout Mountain</option> <option value="PAU">Paulina</option> <option value="redmond">Redmond Air Center</option> <option value="sisters">Sisters</option> <option value="test">test</option> </select></dd> </dl> </fieldset> <fieldset id='Facility_Location_set'> <legend>Facility Location</legend> <div><input type='radio' name='Facility_Location' value='BFR' id='Facility_Location_BFR' /> Bend Fort Rock</div> <div><input type='radio' name='Facility_Location' value='BPAS' id='Facility_Location_BPAS' /> Bend Pine Admin. Site</div> <div><input type='radio' name='Facility_Location' value='CRES' id='Facility_Location_CRES' /> Crescent</div> <div><input type='radio' name='Facility_Location' value='GRLD' id='Facility_Location_GRLD' /> Crooked River National Grasslands</div> <div><input type='radio' name='Facility_Location' value='LKMT' id='Facility_Location_LKMT' /> Lookout Mountain</div> <div><input type='radio' name='Facility_Location' value='PAU' id='Facility_Location_PAU' /> Paulina</div> <div><input type='radio' name='Facility_Location' value='RAC' id='Facility_Location_RAC' /> Redmond Air Center</div> <div><input type='radio' name='Facility_Location' value='SIS' id='Facility_Location_SIS' /> Sisters</div> </fieldset> <fieldset id='BFR_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='BFR_type' value='Fall River Guard Station' id='BFR_type_Fall River Guard Station' /> Fall River Guard Station</div> <div><input type='radio' name='BFR_type' value='Lavalands Vistor Center' id='BFR_type_Lavalands Vistor Center' /> Lavalands Vistor Center</div> <div><input type='radio' name='BFR_type' value='Lookout' id='BFR_type_Lookout' /> Lookout</div> <div><input type='radio' name='BFR_type' value='Paulina Lake GS' id='BFR_type_Paulina Lake GS' /> Paulina Lake GS</div> <div><input type='radio' name='BFR_type' value='Scott St.' id='BFR_type_Scott St.' /> Scott St.</div> <div><input type='radio' name='BFR_type' value='Snow Creek' id='BFR_type_Snow Creek' /> Snow Creek</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='BPAS_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='BPAS_type' value='Coolers' id='BPAS_type_Coolers' /> Coolers</div> <div><input type='radio' name='BPAS_type' value='Equipment Storage Bld.' id='BPAS_type_Equipment Storage Bld.' /> Equipment Storage Bld.</div> <div><input type='radio' name='BPAS_type' value='Lab' id='BPAS_type_Lab' /> Lab</div> <div><input type='radio' name='BPAS_type' value='New Office' id='BPAS_type_New Office' /> New Office</div> <div><input type='radio' name='BPAS_type' value='Packing Shed' id='BPAS_type_Packing Shed' /> Packing Shed</div> <div><input type='radio' name='BPAS_type' value='Shop' id='BPAS_type_Shop' /> Shop</div> </fieldset> <fieldset id='CRES_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='CRES_type' value='Crescent Lake G.S.' id='CRES_type_Crescent Lake G.S.' /> Crescent Lake G.S.</div> <div><input type='radio' name='CRES_type' value='Lookout' id='CRES_type_Lookout' /> Lookout</div> <div><input type='radio' name='CRES_type' value='Office Compound' id='CRES_type_Office Compound' /> Office Compound</div> <div><input type='radio' name='CRES_type' value='Rosedale' id='CRES_type_Rosedale' /> Rosedale</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='GRLD_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='GRLD_type' value='Field Headquarters' id='GRLD_type_Field Headquarters' /> Field Headquarters</div> <div><input type='radio' name='GRLD_type' value='Lookout' id='GRLD_type_Lookout' /> Lookout</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='LKMT_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='LKMT_type' value='Dispatch' id='LKMT_type_Dispatch' /> Dispatch</div> <div><input type='radio' name='LKMT_type' value='Helibase' id='LKMT_type_Helibase' /> Helibase</div> <div><input type='radio' name='LKMT_type' value='Lamonta' id='LKMT_type_Lamonta' /> Lamonta</div> <div><input type='radio' name='LKMT_type' value='Lookout' id='LKMT_type_Lookout' /> Lookout</div> <div><input type='radio' name='LKMT_type' value='Ochoco R.S.' id='LKMT_type_Ochoco R.S.' /> Ochoco R.S.</div> <div><input type='radio' name='LKMT_type' value='Ranger Rental' id='LKMT_type_Ranger Rental' /> Ranger Rental</div> <div><input type='radio' name='LKMT_type' value='S.O.' id='LKMT_type_S.O.' /> S.O.</div> </fieldset> <fieldset id='PAU_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='PAU_type' value='Cold Spring Rental' id='PAU_type_Cold Spring Rental' /> Cold Spring Rental</div> <div><input type='radio' name='PAU_type' value='Lookout' id='PAU_type_Lookout' /> Lookout</div> <div><input type='radio' name='PAU_type' value='Rager' id='PAU_type_Rager' /> Rager</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='RAC_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='RAC_type' value='Admin' id='RAC_type_Admin' /> Admin</div> <div><input type='radio' name='RAC_type' value='Air Tanker Base' id='RAC_type_Air Tanker Base' /> Air Tanker Base</div> <div><input type='radio' name='RAC_type' value='Barracks' id='RAC_type_Barracks' /> Barracks</div> <div><input type='radio' name='RAC_type' value='Cache' id='RAC_type_Cache' /> Cache</div> <div><input type='radio' name='RAC_type' value='Paraloft' id='RAC_type_Paraloft' /> Paraloft</div> <div><input type='radio' name='RAC_type' value='RAG' id='RAC_type_RAG' /> RAG</div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='SIS_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='SIS_type' value='Allingham' id='SIS_type_Allingham' /> Allingham</div> <div><input type='radio' name='SIS_type' value='Lookout' id='SIS_type_Lookout' /> Lookout</div> <div><input type='radio' name='SIS_type' value='Office Compound' id='SIS_type_Office Compound' /> Office Compound</div> <div><input type='radio' name='SIS_type' value='Portal' id='SIS_type_Portal' /> Portal</div> <div><input type='radio' name='SIS_type' value='Warehouse Compound' id='SIS_type_Warehouse Compound' /> Warehouse Compound</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset> <legend>Maintenance Area</legend> <dl> <dt><label for="Type_of_Error">Problem that you would like to Report *</label></dt> <dd><select class="inputselect" name="Type_of_Error" id="Type_of_Error"> <option value="Select One">Select One ...</option> <option value="Doors/Locks/Gates = Access">Doors/Locks/Gates = Access</option> <option value="Fence">Fence</option> <option value="HVAC">HVAC</option> <option value="Lights">Lights</option> <option value="Restrooms">Restrooms</option> <option value="Windows/Blinds">Windows/Blinds</option> <option value="Other">Other</option> </select></dd> </dl> </fieldset> <fieldset> <legend>Miscellaneous Information</legend> <dl> <dt><label for="Additional_Information">Please Describe the Problem You are Reporting</label></dt> <dd><textarea class="inputtextarea" id="Additional_Information" name="Additional_Information" rows="11" cols="65"></textarea></dd> </dl> </fieldset> <fieldset> <legend>Send Email To Us</legend> <dl> <dt><label for="submit">Submit Form</label></dt> <dd><input class="inputsubmit" type="submit" id="submit" name="submit" value="Let us Know!" /></dd> </dl> </fieldset> </form> </div> <!--#endif --> <!-- InstanceEndEditable --> <!--#include virtual="/global/ssi/2009-fs2-contribute2.shtml" --> </div> <!-- CLOSE content-wrapper --> <!--#include virtual="/global/ssi/2009-fs2-footer.shtml" --> </div> <!-- CLOSE page-wrapper --> </body> <!-- InstanceEnd --></html> Hi, I am fairly new to this so please bare with me. I have a php page that uses Javascript (I think) to calculate the percentage Insurance Premium Tax (IPT field) of a total. I have located where the calculation occurs and can see that it take the total of a predefined amount and divides it by 21 to give me the 5% IPT tax. IPT has risen in the UK today to 6% so I need to know what I need to change the 21 to to give me an accurate IPT calculation. Here's a snippet of the code. Can anyone help please? Is it 17.65? PHP Code: //////////////////////////////////////////// // Motor Bike Calculations //////////////////////////////////////////// $p = 3; $q = 0; while ($p < 6){ $base_array = mysql_fetch_row($result4); // Motor Bikes $risk_code = 2; $ap = (0 + ($p)); $ipt_rate = $ipt_main; $monthly_total = $pricing_row[$ap]; // Calculate IPT $ipt_percentage = $monthly_total / 21; $monthly_ipt = $ipt_percentage; $base_cost = $base_array[0] + $dealer_loading; $base_final = $base_cost; $profit = $monthly_total - $base_cost - $monthly_ipt; $monthly_total = number_format($monthly_total, 2, '.', ''); $monthly_ipt = number_format($monthly_ipt, 2, '.', ''); $base_final = number_format($base_final, 2, '.', ''); $profit = number_format($profit, 2, '.', ''); echo ' <tr align="center" bgcolor="#FFDDFF"> <td>'; if ($p == 3) { echo (''); } elseif ($p == 4) { echo ('UK'); } elseif ($p == 5) { echo ('UK & European'); } echo '</td> <td> <input name="'; if ($p == 3) { echo ('comprehensive_plus_'.$risk_code); } elseif ($p == 4) { echo ('comprehensive_'.$risk_code); } elseif ($p == 5) { echo ('driveline_plus_'.$risk_code); } echo '" type="text" value="'.$pricing_row[$ap].'" size="6" maxlength="6" class="smallinfo"> </td> <td>'.$monthly_ipt.'</td> <td>'.$base_final.'</td> <td>'.$profit.'</td> </tr>'; $q++; $p++; } |