Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
<script type="text/javascript">
/* <![CDATA[ */
var elem = document.getElementById('foobar');
elem.oninput = function() {
alert('Neuer Wert: ' + this.value);
};
/* ]]> */
</script>
<!--[if lte IE 8]>
<script type="text/javascript">
/* <![CDATA[ */
var oldValue = elem.value;
setIntervall(function() {
if(oldValue !== elem.value) {
oldValue = elem.value;
elem.oninput.call(elem);
}
}, 50);
/* ]]> */
</script>
<![endif]-->
<html>
<head>
<script type="text/javascript">
// Firefox, Google Chrome, Opera, Safari, Internet Explorer from version 9
function OnPaste (event) {
alert ("The new content: " + event.target.value);
}
</script>
</head>
<body>
Please modify the contents of the text field.
<input type="text" onpaste="OnPaste (event)" value="Text field" />
</body>
</html>
There is currently no DOM-only way to obtain the text being pasted; you'll have to use an nsIClipboard to get that information.
<html>
<head>
<script type="text/javascript">
// Firefox, Google Chrome, Opera, Safari, Internet Explorer from version 9
function OnPaste (e) {
var _this = this;
setTimeout(function() {
alert(_this.value);
});
}
</script>
</head>
<body>
Please modify the contents of the text field.
<input type="text" onpaste="OnPaste.call(this, event)" value="Text field" />
</body>
</html>
<html>
<head>
<script type="text/javascript">
var paste = {
isPating: false,
// geht nicht mit paste.observe("text");
observe: function(element) {
var el = document.getElementById(element);
el.onpaste = this.onPaste();
el.oninput = this.onInput();
},
onPaste: function() {
isPasting = true;
},
onInput: function(event) {
if(isPasting) {
isPasting = false;
alert("pasting!: " + event.target.value);
}
}
};
</script>
</head>
<body>
Please modify the contents of the text field.
<input id="text" type="text" onpaste="paste.onPaste();" oninput="paste.onInput(event);" value="Text field" />
</body>
</html>
<html>
<head>
<script type="text/javascript">
var paste = {
isPasting: false,
observe: function(element) {
var el = document.getElementById(element);
el.onpaste = this.onPaste;
el.oninput = this.onInput;
},
onPaste: function() {
this.isPasting = true;
},
onInput: function(event) {
if(this.isPasting) {
this.isPasting = false;
alert("pasting!: " + event.target.value);
}
}
};
window.onload = function() {
paste.observe("text");
};
</script>
</head>
<body>
Please modify the contents of the text field.
<input id="text" type="text" value="Text field" />
</body>
</html>