[thelist] Re: javascript "won't" subtract

Rebecca O Connell rloconne at unity.ncsu.edu
Mon Mar 10 09:34:01 CST 2003


Emma:

I tried your site in IE 5.1 for Mac and I got an error message telling me
that " 'doc.getElementbyID(...).style' is not an object". When I tell it to
disregard this message the slide show loads except for one large rectangular
block of it that covers most of the top half of the image plus the bottom
half of the caption.

> Message: 21
> Date: Sat, 8 Mar 2003 16:45:46 -0600
> Subject: Re: [thelist] javascript "won't" subtract
>> From: Erik Mattheis <gozz at gozz.com>
> To: thelist at lists.evolt.org
> Reply-To: thelist at lists.evolt.org
>
> A couple things, don't know which or both may be causing the problems
> ...
>
> JavaScript isn't a typed language, so it will treat a number as a
> number when needed and as a string when needed - so no need to use
> parseInt() (that's not the problem but it's unneeded.
>
> JavaScript variables cannot start with numbers and eval(slide - 1)
> looks to me like it might be asking javascript to think of a number as
> a variable.
>
> Also, I believe the same naming convention of not starting with a digit
> applies to the id and name attributes in HTML ... so rename your
> attributes like "slide1" and try this:
>
> function showImg(
> var img = document.forms[0].nextVal.value;
>
>        if (img <= 0) { slide = 1; }
>        else if (choice == "start") { slide = 1; }
>        else if (choice == "next") { slide++; }
>        else if (choice == "prev") { slide--; }
>
>       var photo = document.getElementById(slide).style;
>       photo.display = "block";
>       photo.visibility = "visible";
>        document.forms[0].nextVal.value = 'slide' + slide;
>        document.forms[0].img.value = img;
>
> }
>
> <form>
> <input onclick="showImg('prev');" type="button" name="back"
> value="previous image" />
> <input onclick="showImg('start');" type="button" name="start"
> value="start" />
> <input onclick="showImg('next');" type="button" name="next" value="next
> image" />
> <input type="text" name="nextVal" value="0" />
> <input type="text" name="img" value="" />
> </form>
> On Saturday, March 8, 2003, at 11:28  AM, Emma Jane Hogbin wrote:
>
>> Does anyone see anything obvious in what I've done? I've been testing
>> it
>> in Phoenix (linux) and Mozilla (windows
> -----------------------
> Erik Mattheis
> GoZz Digital
> <http://goZz.com/>
> Flash and ColdFusion Development
> Minneapolis, MN
> -----------------------




More information about the thelist mailing list