Ik ben een beetje aan het testen met het zelf classes aanmaken in JS, en ik heb dit maar het werkt niet. Kan iemand mij vertellen hoe dit komt?
<html>
<head>
<script>
function create(el){
this.el = el;
this.fill();
}
create.prototype.fill = function(){
alert(this.el.innerHTML);
}
</script>
</head>
<body>
<form>
<input onfocus="create(this);" name="test" autocomplete="off"/>
<input type="submit">
</form>
</body>
</html>
Alvast bedankt.
----
werkt nu, create(this) is this.prop = create(this) geworden.
<html>
<head>
<script>
function create(el){
this.el = el;
this.fill();
}
create.prototype.fill = function(){
alert(this.el.innerHTML);
}
</script>
</head>
<body>
<form>
<input onfocus="create(this);" name="test" autocomplete="off"/>
<input type="submit">
</form>
</body>
</html>
Alvast bedankt.
----
werkt nu, create(this) is this.prop = create(this) geworden.
Laatst bewerkt: