I am going to use javascript to calculate a value depending on what the user selects from a dropdown menu.
I have 2 columns in a table and a dropdown menu. The value in the 2nd column is going to be calculated by taking a percentage of the number that is hardcoded in the 1st column.
The user will select an option from the drop down e.g. 10% 20% 30% etc... and the value in the 2nd column will be calculated according to the percentage of the value in the 1st column.
I am using a JavaScript price calculator. Right now it does everything I need except for one thing.
If you look at the "type" field, they can choose either woven or printed. Right now, if they choose "woven" it adds 6 cents to to the total as you can see in this portion of the code:
if (theForm.select.value=="woven") { priceeach+=0.06;
Rather than 0.06, how do I get it to add a percentage--say 20%
I have divs on a page that are placed in the center with something like width:100px;height:100px;position:fixed;top:50%;left:50%;margin:-50px, 0, 0, -50px; I want to animate this div to the bottom left (similar tominimizingeffect on windows)
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title>
[code]....
My problem here is that I am calculating the percentage values of a whole number and storing those values in text boxes respectively through javascript function.Now,what I need is that I want to round all the values to integer value such that the sum of integer values is equal to the final value.
I am having an issue with converting my decimal to a percentage. Below is my code: (cost * .06) is where the issue is var cost = prompt("What is the cost of your purchase?", "") document.write("Return Value: "+cost,("<br />")); var salestax = cost * .06 document.write("Return Value: "+salestax,("<br />")); var total = cost + salestax document.write(cost + salestax);
I want to calculate the percentage of a number, but I'm getting a really weird result. In the following code f is equal to 3 and x.length is equal to 8. The part that isn't working is emphasised in bold. Basically 3/8 * 100 should result in 37.5 but the result I am getting with the following code is 7934570.3125. How do you calculate this percentage in Javascript?
I am writing a form and doing a bunch of calculations one of which is a percentage based on the value selected. I am returning a correct result for two of the values but for the other two I am not.The 'discount' value is what I am looking for. It should return as 0 for values of 1 but it is doing the math as though it is multiplying by 1. And again for the value of 6 it should be 10% but is taking the value as 4.6 or something.Code is below I've included all of it (sorry) for better ease of understanding the math that is happening:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
[code]....
My problem here is that I am calculating the percentage values of a whole number and storing those values in text boxes respectively through javascript function.Now,what I need is that I want to round all the values to integer value such that the sum of integer values is equal to the final value.
Everything is working but I'm trying to replace the "A8" part with a percentage typed in by the viewer.The percentage is simply a non-decimal number between 0 and 100 typed into a box.I know how to grab the value of the box (again, it's 0-100) but how do I convert that number into it's "A8" equivalent?
I am wondering if anybody can provide statistics what is percentage of visitors with disabled JavaScript.
Even more interesting would be statistics of users with disabled JavaScript making a purchase. I am more likely to purchase from my home than from work and I think the disabled JS is mostly result of IT dept. policies.
Is e-commerce site missing much if requires JavaScript?
I'm stuck on how to calculate the payment fee of 1.61% on top of the membership price. Also, how do I round the figures to 2 decimal places?Here's the Javascript so far:
<script type="text/javascript"> var member_prices = new Array(); member_prices["no"]=235.00;[code].....
I am implementing a zoom in feature, but actually tricking the user as a full screen image is simply being stretched.
I plan to apply it to several pages, and don't really fancy working out the pixels for each.
I believe that if you simply put width: 150% height 150% it will change the image size relative to the browser. I don't want that, I want it relative to the original image size. Could I do sort of height*1.5 or something? How would I write that if so?
I didn't write much of this code, but basically, it opens an image in a new window. The problem is that the new window can either be the whole page, or a certain set size. I would like to make the window height and width determined not by a pixel number, but by a percentage of the size of the image I am opening in the new window.
here is the piece of code I think is pertinant.
// Strip file name from image src var spath=targ.getAttribute('src'); wholePathLength=spath.length; strippedPathLength=spath.substring(0,spath.lastIndexOf("/")).length;
I am trying to customize this scrollbar so that it will fit all screen resolutions and I was wondering how I could do this by somehow customizing the JavaScript files created by Nathan Faubion or if I could do this using other JavaScript variables (var widthPercentage) to change the pixels to percentages?One of the pages on the website I'm using the JavaScript on
JavaScript file jsScroller.js: //Created by Nathan Faubion http://www.n-son.com/scripts/jsScrolling/ function jsScroller (o, w, h) {
I'm setting position left to 100% and it works except in Chrome/safari. These browsers set it about 100px from the left not 100%obj.css('left', '100%');Setting the css by itself <img src="" style="left:100%;position:absolute" works fine.I don't know if this is a browser problem or a jquery problem.
This code works to insert a MySQL record to a Database using AJAX. It works fine on IE, but it's not working on FF or Chrome. When I test it on FF/Chrome, i just get the text "Just a second..." and it doesn't advance from there.
I am working on a Javascript application and i am facing a strange behavior of the application in IE. I am creating a table at runtime using DHTML and registering event for the table row click. When i deploy this application on web server and browse the application, the events fires in firefox and chrome but in IE the events are not fired. If i browse the application from the server with localhost, the application triggers the events and fails when i use machine name.
The following is the source code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title>
I am trying to create 3 boxes with 2nd select box content to be uploaded on the basis of value selected in first box and third box list should be uploaded on the basis of value selected in 2nd box.i have written coding for that as below but it is not working .
I was using JQuery 1.2.6 but after I downloaded the version 1.4.2 I get the following error on FireFox: uncaught exception: Syntax error, unrecognized expression: .
I have are created dynamically buttonset toggle radio button with following code. All is working okay but just I have added onclick function which is doing window.location which is working with FireFox but not working with IE and google chrome.
<script type="text/javascript"> var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $(function () { $('#btnSet').buttonstrip();