help with an error - very short code

Discussion in 'Javascript' started by janice, Sep 17, 2004.

  1. janice

    janice Guest

    Hi all,

    Can someone tell me why this won't work? (I get a
    "document.images.whichpic is null or not an object" message.)

    -----

    var numbeads = 0;

    function addABead(whichbead, w, h) {

    var whichpic = "pic" + numbeads;

    document.images.whichpic.src = whichbead;
    document.images.whichpic.width = w;
    document.images.whichpic.height = h;

    numbeads += 1;

    }

    -----

    Thank you in advance for your help!

    J.
     
    janice, Sep 17, 2004
    #1
    1. Advertising

  2. janice

    Philip Ronan Guest

    Try document.images["whichpic"].src

    --
    Philip Ronan

    (Please remove the "z"s if replying by email)
     
    Philip Ronan, Sep 17, 2004
    #2
    1. Advertising

  3. janice

    Philip Ronan Guest

    On 17/9/04 2:46 pm, Philip Ronan wrote:

    > Try document.images["whichpic"].src


    Oops, lose the quotes. Sorry

    document.images[whichpic].src

    --
    Philip Ronan

    (Please remove the "z"s if replying by email)
     
    Philip Ronan, Sep 17, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    509
    Raymond Hettinger
    Jul 27, 2003
  2. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,699
    Merrill & Michele
    Oct 19, 2004
  3. Abhishek Jha

    very very very long integer

    Abhishek Jha, Oct 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    452
    jacob navia
    Oct 17, 2004
  4. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    532
    Dave Thompson
    Feb 14, 2005
  5. olivier.melcher

    Help running a very very very simple code

    olivier.melcher, May 12, 2008, in forum: Java
    Replies:
    8
    Views:
    2,352
Loading...

Share This Page