Re: myJavaScriptQuestion

by Nathan Lyle <natlyle(at)nmu.edu>

 Date:  Thu, 15 Mar 2001 01:34:03 -0500
 To:  "Michael" <miklbike(at)neo.rr.com>
 Cc:  hwg-techniques(at)hwg.org
 In-Reply-To:  rr
  todo: View Thread, Original
I'll take a crack at it.. but i've been starting at my screen quite a bit
too... so don't take this for gospel.... <grin>

You have in your page:

function changeAccessoryPage(){
         var accessoryName = document.myForm.acc.value;
         if ( accessoryName == 'skateboards' ) {
                 return false;
                 }
         else
                 window.location.href = ( "skateboards/" + accessoryName +
".htm" )
}

change the first line in the function to:

         var accessoryName =
document.myForm.acc.options[document.myForm.acc.selectedIndex].value;

And it should work. (I didn't double check on your html file names and
locations... I was just focusing on the null issue.)


>Would anyone like to take a crack at why this javascript does not work in NS
>4.7? The thing is, it works on my local machine, but when I upload it, it
>reads the variable "accessoryName" as null. That really throws me - why
>would it work locally and not on the net?
>
>The url is http://www.erniesbikeshop.com/products/skateboards.shtml
>
>I have similar code at
>http://www.erniesbikeshop.com/ernies_about/bios.shtml
>which works fine in both IE and NS. The only difference is I use
>selectedIndex to assign a value to the var, instead of assigning the value
>directly. When I tried this technique with the above skateboard url it
>refered to my external style sheet. Now how does that happen?
>
>If anyone has any ideas I'd really appreciate it. I've been staring at this
>snippet for 2 hours and I'm going to bed now. I'll look at it again
>tomorrow.
>
>Thanks.
>
>Michael Barath
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Michael Barath
>Stark State College of Technology
>6200 Frank Ave NW
>Canton, OH  44720-7299
>330.966.5461
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~Nathan Lyle   (The Tragic Comedian Poet)

Email:  natlyle(at)nmu.edu    or    jopling(at)geocities.com
Web: http://euclid.nmu.edu/~natlyle
Phone: 906-227-5736

"To discusss an opinion with a fool is like carrying a lantern before a
blind man." - De Gaston

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA