Need new eyes on this problem.

Questions about programming languages and debugging
Post Reply
User avatar
Big-E
Administrator
Administrator
Posts: 1332
Joined: 16 May 2007, 16:00
16
Location: IN UR ____ , ____ING UR _____ .
Contact:

Need new eyes on this problem.

Post by Big-E »

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]

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Post by maboroshi »

Quotes is the same as PHP \" \"

\ escape ;)

can't help with Javascript to much though sorry

G-Brain
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 467
Joined: 08 Nov 2007, 17:00
16
Location: NL

Re: Need new eyes on this problem.

Post by G-Brain »

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?
You realized wrong, what exactly do they have in common?

Your description is also pretty vague, you might wanna elaborate on that, hope I can help.

User avatar
Big-E
Administrator
Administrator
Posts: 1332
Joined: 16 May 2007, 16:00
16
Location: IN UR ____ , ____ING UR _____ .
Contact:

Post by Big-E »

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.

Post Reply