[ale] OT: Javascript help.....again

Jim Seymour jim at wingbarscafe.com
Wed Nov 7 12:24:39 EST 2007


On Wed, 2007-11-07 at 12:11 -0500, Bj?rn Gustafsson wrote:
> Hi Jim,
> 
> > Were you just talking about using View Source from Firefox and
> > saving it to a .htm page? If so, then you are correct and it fails
> that
> > way as well.
> 
> Yup, that's what I meant.
> 
> Since that fails, unless you get other javascript errors it means you
> need to adjust the way the javascript finds the image elements of the
> HTML document.  Javascript references elements of the HTML document
> via the Document Object Model, or DOM.
> 
> You can read some information about how DOM works here:
> http://www.howtocreate.co.uk/tutorials/javascript/dombasics
> 
> When your javascript references document["webCam_"+this.camNum] it is
> assuming that the image element named "webCam_"+this.camNum (e.g.
> "webCam_0") is inside the main <body> block of the HTML document, not
> inside a subsection like a <DIV>.  To find it, you need to look it up
> by a different means that either knows where it is and refer to it as
> something like document.page.content.post.entry.firstChild.firstChild,
> or you can give it an ID value and look it up by that ID.
> 
> ... Actually as I looked at your page again, the problem is much
> simpler:  you are calling WebCamDraw() with the wrong number of
> arguments.  It wants four inputs: camera number, width, height, and
> alternate tag.  You are only passing in the camera number.
> 
> Try changing your page to call like this:
> 
>  webCamDraw(0,"","","bird feeder");
> 
> and see if it works then.  If not, you'll likely need to read up on
> getElementById(). 

Many Thanks Bj?rn,

I will work on this.

Later,
Jim



More information about the Ale mailing list