Hallo,
- Versuch, da vielleicht das Attribut ignoriert wird (da eigentlich ungültig):
<script type="text/javascript">
ctrl = document.getElementById('from_row_0_AmPm');
if(ctrl != null && typeof ctrl.onchange == 'undefined')
ctrl.onchange = new Function("alert('test');");
</script>
>
> Aber auch so bleibt onchange undefined.
Nö, bei mir nicht
~~~html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Titel</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<div id="from_row_0_AmPm" OnClick="alert('click')" OnFocus="alert('focus')" OnBlur="alert('blur')" OnChange="alert('change')" style="width:40px;">
test
</div>
<script type="text/javascript">
<!--
var box = document.getElementById("from_row_0_AmPm");
if (!box.onchange) {
//box.onchange = function() {alert('change');};
box.onchange = new Function("alert('test');");
}
alert(box.onclick);
alert(box.onfocus);
alert(box.onblur);
alert(box.onchange);
box.onclick();
box.onfocus();
box.onblur();
box.onchange();
//-->
</script>
</body>
</html>
Die auskommentierte Schreibweise funktioniert übrigens auch.
viele Grüße
Axel