| Author |
Dynamic Element Function Parameter
|
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
I am creating a DIV like so: var div = document.createElement("DIV"); and adding an onmousedown function like so div.onmousedown = someFunction; What I need to do though is pass an argument to someFunction. If I create it statically, it would take 2 arguments (event, id). I know that the above code passes event automatically, but how can I also pass it a string value for id? Thanks.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
something like?: = function(){someFunction(event,"id");} Eric
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Well, I tried that before, and it says that event is not defined. What I am trying to duplicate dynamically is the following static html:
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
Something like this: [ugh smiles!] [ugh mistake - should work now in FF] [ March 28, 2006: Message edited by: Eric Pascarello ]
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
I get event is not defined, in FF.
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
Ok, well, while I await anyone's suggestions for the above solution, I have figured out a workaround. I created the DIV in HTML and set the display to none. When I need a new one, I use the cloneNode function of that div, give it a new ID and various other properties and all works well.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
It should have worked if I would have not typed it wrong.... Eric
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
Perfect Eric. Thanks.
|
 |
 |
|
|
subject: Dynamic Element Function Parameter
|
|
|