For starters, I never really even tried using javascript before but I realised that's identical to Java. I guess that name doens't suggest anything, now does it? Anyway, what I am trying to do is print a drop down box for values 1-120 for Width and Lenth 1-120 (plus other 4 values) so that it calculates the price based on a price matrix. So for example a product 5inches x 10 inches would fall under the price of 24inches x 36inches based on the price matrix. These values are being passed into a php function called get_price() I have created, but I don't really need to post it cause it doesn't effect the question at hand. Anyway, there are two problems associated.
1. When the code is passed it's the value, which is passed and not the i (which would be a number based on the for loop) How would I retrieve this number between the two <option></option> tags so that I can print it in the receipt?
2. How the fuck do I print quotes within JS so I can product valid xHTML?
document.write("<option value="VALUEHERE">" ); wont work - suggestions?
Code is located here -
[/end stupidity]
Need new eyes on this problem.
Re: Need new eyes on this problem.
You realized wrong, what exactly do they have in common?Big-E wrote:For starters, I never really even tried using javascript before but I realised that's identical to Java. I guess that name doens't suggest anything, now does it?
Your description is also pretty vague, you might wanna elaborate on that, hope I can help.
- Big-E
- Administrator
- Posts: 1332
- Joined: 16 May 2007, 16:00
- 16
- Location: IN UR ____ , ____ING UR _____ .
- Contact:
for loop syntax, if statement syntax to begin with - as I said, I've never used it before and just realised basic syntax was similar.
As per re: more elaborate description.
Price Matrix
Width: 24 30 36
Length
36 $436 $492 $544
42 $471 $529 $596
48 $505 $556 $649
So say I have a user who selects the width x length as 26 x 37, then the price would be based on the values rounded to the next nearest value (existant values on the matrix) so in this case it would be 30 x 42 and therefore the price of that sized (Window blinds in the case) would be $529. Is that of more clarity?
So, what I need to do is create a drop down menu from 1-120 for width and length (as these are the possible lengths/widths available) and for width there are also possible selections which will be coded manually and not via a loop.
As per re: more elaborate description.
Price Matrix
Width: 24 30 36
Length
36 $436 $492 $544
42 $471 $529 $596
48 $505 $556 $649
So say I have a user who selects the width x length as 26 x 37, then the price would be based on the values rounded to the next nearest value (existant values on the matrix) so in this case it would be 30 x 42 and therefore the price of that sized (Window blinds in the case) would be $529. Is that of more clarity?
So, what I need to do is create a drop down menu from 1-120 for width and length (as these are the possible lengths/widths available) and for width there are also possible selections which will be coded manually and not via a loop.