我有以下脚本,我需要检测:
我不能在按钮本身上使用此逻辑。
有什么活动?您能否提供代码示例?
http://jsbin.com/sewerumive/1/
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script>
window.App = {
start: function () {
var btn = document.getElementById('addContent');
btn.addEventListener('click', function () {
var body = document.getElementsByTagName('body')[0];
body.innerHTML += '<p>ADDED LATER - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>';
});
//---
// does not work i need the content
window.addEventListener('resize', function () {
console.log('content / window / resize');
});
var content = document.getElementById('content');
content.addEventListener('change', function () {
console.log('content / div / resize');
}.bind(this));
}
};
</script>
</head>
<body onload="App.start();">
<div id="content">
<button id="addContent" type="button">Add content!</button>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</body>
</html>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句