PDA

View Full Version : Assistance with a page


Pedster2k
06-27-2003, 09:53 AM
This might be a waste of my time as I posted a link which had errors ages ago, but no-one assisted.

Anyway, here goes. What it is that I have 5 buttons - each will lead onto another page passing parameters to it, however I keep getting a 'xxxxxx is undefined' error. Do I need to define these as variables in a previous script??

The offending page is here (http://www.pedsters-planet.co.uk/dir/suggest.htm?category=This_Is_A>Test)

Any help will be grateful

Kor
06-27-2003, 10:39 AM
You have called in the page a function go(), but I dont see where is your function, probably in your js.file...

I am not very sure, I din's see the script, but...
Anyway, probably in that script the function should be something like:

function go(blabla) {

if (blabla =adultmonthly){
whichever action u have to...
}

if (blabla =adultyearly){
whichever action u have to...
}
.
.
.
}
and so on

Probably there is no parameter inside the function go. You can call it blabla, or nomatter the name...

Pedster2k
06-27-2003, 10:51 AM
Originally posted by Kor
You have called in the page a function go(), but I dont see where is your function, probably in your js.file...


Heres the function:

function go(here) {
category = unescape(params["category"]);
if(here=="expressmonthly") {
top.location = "http://www.pedsters-planet.co.uk/dir/suggest_a_site_2.htm?category=\"+category+\"&p=express&pay=monthly";
}
else if(here=="expressyearly") {
top.location = "http://www.pedsters-planet.co.uk/dir/suggest_a_site_2.htm?category=\"+category+\"&p=express&pay=yearly";
}
else if(here=="adultmonthly") {
--(snipped)--

and heres a button code:

---
document.write("<input type=\"button\" name=\"buy\" value=\"Buy Monthly\" onclick=\"go(expressmonthly)\"");
----

I always thought that 'expressmonthly' (for example) would be the contents of whatever you put in brackets for a function? If you understood that.

Thanks
Pedster

Kor
06-27-2003, 11:21 AM
hm...

I used often that sort of passing params, but i prefere to use digits instead of expression. Thus, I have no problem with the brackets (the ethernel doubt: with or without brackets? :-))

I use

onevent = "thisfunction(1)"
onevent = "thisfunction(2)"

and

function thisfunction (bla){

if(bla==1) {

...

}
if(bla==2) {

...

}
}

I am not so sure, but u probably have to use
go('expressmonthly') not go(expressmonthly). Anyway, as I've told u, I use digits for avoiding any brackets confusion or error