17
rated 0 times
[
23]
[
6]
/ answers: 1 / hits: 92582
/ 13 Years ago, wed, december 28, 2011, 12:00:00
I'm trying to use javascript to create a button that has a onclick event that calls a function defined in the head that takes in as parameter a dom object relative to the button. how do i do this?
ex:
<html>
<head> <script>function blah(obj){alert(obj.value)}</script></head>
<body>
<button onclick=blah(this.parentNode.value);></button>
</body>
</html>
javascript:
var newButton = document.createElement(button);
???
in the end i want the new button to be the same as the existing one.
More From » dom