Click to See Complete Forum and Search --> : onclick


AntonioMainenti
04-21-2003, 11:17 AM
In the JavaScript I'm writing I need to change the .onclick properties of some images. From what I understand, the syntax is:

document.getElementById('asdf').onclick=function;

But I need 'function' to use some parameters, and when I included those, it gave an error that said it wasn't implemented or something.

Does anyone know how to do this? Thanks.

Alan.

AdamBrill
04-21-2003, 12:02 PM
Is this what you wanted?
document.getElementById('asdf').onclick=function(){
this.style.left="10px";
}That will change the location to 10px when you click it. In order for the positioning to work, though, you must set the position style to absolute...

AntonioMainenti
04-21-2003, 12:10 PM
Yes, thanks a lot.