Calling a function from <a> tag.
Hello WW. I'm working on what should be an easy script. But not for me of course. :( What I want it to do is send item info to the function which contains the long paypal link so I don't have to put it in each item "buy" link.
Here it is:
var sOrder = "https://www.paypal.com/cart/add=1&business=Myidnumber&item_name=" + desc + "&item_number=" + item + "&amount=" + cost + "";
Can't see anything obvious (other than your # in the a href :) )
Your best bet is to put the site in Netscape, click on the link and then type:
Is there really a line break in the stuff going into sOrder?
You're missing a close parenthesis in the link and single quotes around your values:
Note: had to leave a space after the colon 'cause I was triggering a "shocked" smilie!
Tedster's edit: You can turn off smilies as needed - checkbox is two up from the submit button
[edited by: tedster at 12:12 am (utc) on Aug. 3, 2002]
Thank you, toadhall. Now I feel stupid, but I already knew I would with that question. It's hard to spot those syntax errors sometimes. It's working now. Thanks!
Oh yeah, I had to edit my post(turned off smileys), too. It was funny when I first saw it, though. :o
|Is there really a line break in the stuff going into sOrder? |
The easy rule is: except in a few specific cases (e.g. in for statements and literal strings) a semicolon will always end a statement.
var x = a +
...because var x=a+ is not a complete statement. The following, however, is two statements, and the second one gives an error:
var x = a
Please also note that
needs to be:
if you also want the page to validate.