Results 1 to 2 of 2

Thread: Dynamic Table and event handlers

  1. #1

    Thread Starter
    Addicted Member DJ_Catboy's Avatar
    Join Date
    Jan 2003
    Location
    Suffolk, UK
    Posts
    159

    Dynamic Table and event handlers

    Hi,

    I am building a dynamic table using javascript and vbscript in a web page. The code goes something like this:

    Code:
    for x = 1 to 3
      Set row = MyTable.insertrow()
      for y = 1 to 3
        set cell = row.insertcell()
        cell.style.cursor = "hand"
        cell.onmouseover = "javascript:this.style.backgroundColor='red';"
        cell.onmouseout = "javascript:this.style.backgroundColor='White';"
      next y
    next x
    What I want to happen is when you move over each of the cells in a table grid, the current one that the mouse is over changes color. But this code does not work?! Does anybody know why?

    Thanks,
    DJ

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    There should be on javascript: in the event handler. In addition, Mozilla doesn't support this sort of assignment. You need to use addEventHandler for Mozilla and assign to onmouseover for IE, and you'd best use a function object.

    Ok, just noticed this is vbscript so obviously you don't care at all about Mozilla. So no help from me there.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width