Click to See Complete Forum and Search --> : Can anyone tell me what is wrong with this????


jbetts1967
03-05-2003, 06:46 PM
This is the command line from page 1:

<a href="wow01.htm?divagallery01&01&01&01"></a>
divagallery01 = photo gallery
1st 01 = gallery number
2nd 01 = page number
3rd 01 = used to determine which wrestler name to display

This is code is page 02:

<script>
<!--
var gallerydir = location.search.substr(1,13).split("&");
var gallerynum = location.search.substr(15,2).split("&");
var pagenum = location.search.substr(18,2).split("&");
var wrestlernumber = location.search.substr(21,2).split("&");
//-->
</script>

<script language="JavaScript1.1" src="selectwrestler.js"></script>


This is selectwrestler.js:

// Determine which Wrestler

var selectwrestler = " ";

switch (wrestlernumber)
{
case 01 : selectwrestler = "Stacy Keibler"; break;
case 02 : selectwrestler = "Torrie Wilson"; break;
case 03 : selectwrestler = "Lilian Garcia"; break;
case 04 : selectwrestler = "Trish Stratus"; break;
case 05 : selectwrestler = "Stephanie McMahon"; break;
}

document.title = "'Da Man' Bill 'The Annihilator' Goldberg's -- Diva Gallery: " + selectwrestler + " -- Gallery: " +
gallerynum + " --- " + " Page: " + pagenum;

Here is the problem:
when the command line is passed all the variables are getting picked up in the variable names. When I call selectwrestler.js, based on what wrestlernumber is it is supposed to set selectwrestler to a specific wrestler, but it is blank and nothing is displayed, everything else is displayed correctly. do i need to convert wrestlernumber to an integer, if so how is that done?

thanks....

jbetts1967
03-05-2003, 06:57 PM
Originally posted by Dave Clark
switch (wrestlernumber)
{
case '01' : selectwrestler = "Stacy Keibler"; break;
case '02' : selectwrestler = "Torrie Wilson"; break;
case '03' : selectwrestler = "Lilian Garcia"; break;
case '04' : selectwrestler = "Trish Stratus"; break;
case '05' : selectwrestler = "Stephanie McMahon"; break;
}

See the quotes I added above?

Dave

i added the quotes, but it still didn't display the name, i also tried the double quotes and still didnt work? there is no reason why it shouldnt work but its not....????

khalidali63
03-05-2003, 07:01 PM
I might have missed something here,but you did not mention that how are you passing value to the switch statement in the .js file?

because it must be in a function that would have to return the variable

selectwrestler

please post ur complete code.

Khalid

jbetts1967
03-05-2003, 07:05 PM
Originally posted by khalidali63
I might have missed something here,but you did not mention that how are you passing value to the switch statement in the .js file?

because it must be in a function that would have to return the variable

selectwrestler

please post ur complete code.

Khalid

This is the command line from page 1:

<a href="wow01.htm?divagallery01&01&01&01"></a>

// description of variables passed
divagallery01 = photo gallery
1st 01 = gallery number
2nd 01 = page number
3rd 01 = used to determine which wrestler name to display
//

This is code is page 02:
<script>
<!--
var gallerydir = location.search.substr(1,13).split("&");
var gallerynum = location.search.substr(15,2).split("&");
var pagenum = location.search.substr(18,2).split("&");
var wrestlernumber = location.search.substr(21,2).split("&");
//-->
</script>

<script language="JavaScript1.1" src="selectwrestler.js"></script>

This is selectwrestler.js:

// Determine which Wrestler

var selectwrestler = " ";

switch (wrestlernumber)
{
case 01 : selectwrestler = "Stacy Keibler"; break;
case 02 : selectwrestler = "Torrie Wilson"; break;
case 03 : selectwrestler = "Lilian Garcia"; break;
case 04 : selectwrestler = "Trish Stratus"; break;
case 05 : selectwrestler = "Stephanie McMahon"; break;
}

document.title = "'Da Man' Bill 'The Annihilator' Goldberg's -- Diva Gallery: " + selectwrestler + " -- Gallery: " +
gallerynum + " --- " + " Page: " + pagenum;

khalidali63
03-05-2003, 07:14 PM
there 2 changes u need to make it to work

locate this line of code

var wrestlernumber = location.search.substr(21,2).split("&");

and paste this line right underneath it

selctWrestler(wrestlernumber);

then replace all the code in ur.js file with this code


function selctWrestler(wrestlernumber){
var selectwrestler = " ";

switch (wrestlernumber){
case 01 : selectwrestler = "Stacy Keibler"; break;
case 02 : selectwrestler = "Torrie Wilson"; break;
case 03 : selectwrestler = "Lilian Garcia"; break;
case 04 : selectwrestler = "Trish Stratus"; break;
case 05 : selectwrestler = "Stephanie McMahon"; break;
}

document.title = "'Da Man' Bill 'The Annihilator' Goldberg's -- Diva Gallery: " + selectwrestler + " -- Gallery: " +
gallerynum + " --- " + " Page: " + pagenum;
}


This should take care of it

Cheers

Khalid

jbetts1967
03-05-2003, 07:26 PM
Originally posted by khalidali63
there 2 changes u need to make it to work

locate this line of code

var wrestlernumber = location.search.substr(21,2).split("&");

and paste this line right underneath it

selctWrestler(wrestlernumber);

then replace all the code in ur.js file with this code


function selctWrestler(wrestlernumber){
var selectwrestler = " ";

switch (wrestlernumber){
case 01 : selectwrestler = "Stacy Keibler"; break;
case 02 : selectwrestler = "Torrie Wilson"; break;
case 03 : selectwrestler = "Lilian Garcia"; break;
case 04 : selectwrestler = "Trish Stratus"; break;
case 05 : selectwrestler = "Stephanie McMahon"; break;
}

document.title = "'Da Man' Bill 'The Annihilator' Goldberg's -- Diva Gallery: " + selectwrestler + " -- Gallery: " +
gallerynum + " --- " + " Page: " + pagenum;
}


This should take care of it

Cheers

Khalid

do you mean like this:

<script>
<!--
var gallerydir = location.search.substr(1,13).split("&");
var gallerynum = location.search.substr(15,2).split("&");
var pagenum = location.search.substr(18,2).split("&");
var wrestlernumber = location.search.substr(21,2).split("&");
selctWrestler(wrestlernumber);
//-->
</script>

<script language="JavaScript1.1" src="selectwrestler.js"></script>

my.js file:
// Determine which Wrestler

function selctWrestler(wrestlernumber){

var selectwrestler = "not set ";

switch (wrestlernumber)
{
case 01 : selectwrestler = "Stacy Keibler"; break;
case 02 : selectwrestler = "Torrie Wilson"; break;
case 03 : selectwrestler = "Lilian Garcia"; break;
case 04 : selectwrestler = "Trish Stratus"; break;
case 05 : selectwrestler = "Stephanie McMahon"; break;
}

document.title = "'Da Man' Bill 'The Annihilator' Goldberg's -- Diva Gallery: " + selectwrestler + " -- Gallery: " +
gallerynum + " --- " + " Page: " + pagenum;

}

khalidali63
03-05-2003, 07:30 PM
Yes, make sure though, you have appropriately changed the import javascript file code as well

<script language="JavaScript1.1" src="selectwrestler.js"></script>


src="selectwrestler.js"
this file name should be the file name that has the swithc function code .


Cheers

Khalid

jbetts1967
03-05-2003, 07:52 PM
Originally posted by khalidali63
Yes, make sure though, you have appropriately changed the import javascript file code as well

<script language="JavaScript1.1" src="selectwrestler.js"></script>


src="selectwrestler.js"
this file name should be the file name that has the swithc function code .


Cheers

Khalid

its not displaying anything in the title bar... im confused as to why its not working right. it should....

khalidali63
03-05-2003, 07:54 PM
Put an alert statement right after this statement
var wrestlernumber = location.search.substr(21,2).split("&");

so that you know that there is data in the wrestlernumber variable

alert(wrestlernumber )

or zip up all three / 2 files and upload themI'll take a look.

Cheers

Khalid

jbetts1967
03-05-2003, 08:05 PM
Originally posted by khalidali63
Put an alert statement right after this statement
var wrestlernumber = location.search.substr(21,2).split("&");

so that you know that there is data in the wrestlernumber variable

alert(wrestlernumber )

or zip up all three / 2 files and upload themI'll take a look.

Cheers

Khalid

wrestlernumber is being passed as 01 like it is supposed to be.

i did alert(selectwrestler) but nothing was displayed, the alert popup did not popup. but i did alert(selctWrestler) and the entire function was displayed.

jbetts1967
03-05-2003, 08:11 PM
Originally posted by jbetts1967
wrestlernumber is being passed as 01 like it is supposed to be.

i did alert(selectwrestler) but nothing was displayed, the alert popup did not popup. but i did alert(selctWrestler) and the entire function was displayed.

here is a zip of the 3 files:
* goldbergswowpage01.htm
wow01.htm
determinewrestler.js

* = this pages calls wow01.htm, then wow01.htm calles determinewrestler.js

khalidali63
03-05-2003, 08:33 PM
Well here is the error.
in the wow1.html file

you had code like this



<script>
<!--
var gallerydir = location.search.substr(1,13).split("&");
var gallerynum = location.search.substr(15,2).split("&");
var pagenum = location.search.substr(18,2).split("&");
var wrestlernumber = location.search.substr(21,2).split("&");
//alert(wrestlernumber);
selctWrestler(wrestlernumber);
//-->
</script>

<script language="JavaScript1.1" src="determinewrestler.js"></script>


That makes determinewrestler.js file to be not accessiable at right sequence

move the import statement above the code ,just like this


<script language="JavaScript1.1" src="determinewrestler.js"></script>
<script>
<!--
var gallerydir = location.search.substr(1,13).split("&");
var gallerynum = location.search.substr(15,2).split("&");
var pagenum = location.search.substr(18,2).split("&");
var wrestlernumber = location.search.substr(21,2).split("&");
//alert(wrestlernumber);
selctWrestler(wrestlernumber);
//-->
</script>


:D

Cheers

Khalid

jbetts1967
03-06-2003, 04:05 AM
Originally posted by khalidali63
Well here is the error.
in the wow1.html file

you had code like this



<script>
<!--
var gallerydir = location.search.substr(1,13).split("&");
var gallerynum = location.search.substr(15,2).split("&");
var pagenum = location.search.substr(18,2).split("&");
var wrestlernumber = location.search.substr(21,2).split("&");
//alert(wrestlernumber);
selctWrestler(wrestlernumber);
//-->
</script>

<script language="JavaScript1.1" src="determinewrestler.js"></script>


That makes determinewrestler.js file to be not accessiable at right sequence

move the import statement above the code ,just like this


<script language="JavaScript1.1" src="determinewrestler.js"></script>
<script>
<!--
var gallerydir = location.search.substr(1,13).split("&");
var gallerynum = location.search.substr(15,2).split("&");
var pagenum = location.search.substr(18,2).split("&");
var wrestlernumber = location.search.substr(21,2).split("&");
//alert(wrestlernumber);
selctWrestler(wrestlernumber);
//-->
</script>


:D

Cheers

Khalid

i changed it like u suggested but still not working. how can something so simple be so complicated...lol

khalidali63
03-06-2003, 07:45 AM
Could it be that you did not follow the suggestion completely???

:D

Well,I am going to put the wroking example on my webserver,take a look at it and copy the code from there,
here is the link.

http://68.145.35.86/temp/jbetts1967/goldbergswowpage01.htm

Check it out

Cheers

Khalid

jbetts1967
03-06-2003, 05:54 PM
Originally posted by khalidali63
Could it be that you did not follow the suggestion completely???

:D

Well,I am going to put the wroking example on my webserver,take a look at it and copy the code from there,
here is the link.

http://68.145.35.86/temp/jbetts1967/goldbergswowpage01.htm

Check it out

Cheers

Khalid

the difference i saw in what you had and what i had is this:
selctWrestler(""+wrestlernumber);

you had the ""+ in yours and mine didnt. after i put that in it worked perfectly. thank you for your help. JB