I wrote this code by attachEvent
-----------------------------------------------
<input type="Button" name="bt1" value="test">
<script>
function func1()
{
alert("nonargument")
}
bt1.attachEvent("onclick",func1)
</script>
----------------------------------------------
Its work well ,but I want give to func1() an argument:
-----------------------------------------------
<input type="Button" name="bt1" value="test">
<script>
function func1(number)
{
alert(number)
}
bt1.attachEvent("onclick",func1(15))
</script>
----------------------------------------------
But this will eventuate an error!
Why?
The 2nd argument for attachEvent must be a function pointer, and not an actual function call. You can get around this with an anonymous function that calls your function with a parameter.
You have to thank beetle for giving you the code not me silly boy! And you're not using that code tag correctly, you should have commented that line, since it's not a code! BTW how do you know my name?!