M
mowsen
Hey,
simple thing. I try to create a new button which holds a function as
"onclick" attribute.
I tried different ways, varried here and there but without success.
The function in question looks like:
<script type="text/javascript">
function createBt() {
var bt = document.createElement("input");
var attr_type = document.createAttribute("type");
var attr_value = document.createAttribute("value");
var attr_onclick = document.createAttribute("onclick");
attr_type.nodeValue = "button";
attr_value.nodeValue = "create element";
attr_onclick.nodeValue = "createBt()";
bt.setAttributeNode(attr_type);
bt.setAttributeNode(attr_value);
bt.setAttributeNode(attr_onclick);
document.getElementById("xx").appendChild(bt);
}
</script>
This works quite well within Firefox but IE has to be obstructive
again. Any suggestions?
Thanks,
Moka
simple thing. I try to create a new button which holds a function as
"onclick" attribute.
I tried different ways, varried here and there but without success.
The function in question looks like:
<script type="text/javascript">
function createBt() {
var bt = document.createElement("input");
var attr_type = document.createAttribute("type");
var attr_value = document.createAttribute("value");
var attr_onclick = document.createAttribute("onclick");
attr_type.nodeValue = "button";
attr_value.nodeValue = "create element";
attr_onclick.nodeValue = "createBt()";
bt.setAttributeNode(attr_type);
bt.setAttributeNode(attr_value);
bt.setAttributeNode(attr_onclick);
document.getElementById("xx").appendChild(bt);
}
</script>
This works quite well within Firefox but IE has to be obstructive
again. Any suggestions?
Thanks,
Moka