首先,我是 JavaScript 新手。我正在使用aloha编辑器。我想div
通过为每个div
. 使用该 id 我必须调用一个方法,这就是aloha
方法。一切正常,但该aloha
方法没有得到 id。在浏览器上,我得到一个空白空间而不是一个 aloha 框。
这是我的代码..
javascript
var screen=document.getElementById('addScreens');
num_q=document.getElementById('numquest').value;
for(i=0;i<num_q;i++) {
div1=document.createElement("div");
div1.id="multicolumn";
screen.appendChild(div1);
}
//aloha
$(document).ready(function() {
$('#multicolumn').aloha(); //multicolumn is not defined
});
**HTML**
<html>
<body>
<br><input type="text" name = "numquest" id ="numquest" value="" size="5" style="" disabled>
<input type="button" value="submit" onclick="getFields();">
<div id="addScreens"> <br> </div>
</body>
</html>
<style type="text/css">
#multicolumn {
-webkit-column-width:300px;
-webkit-column-gap:30px;
-moz-column-width:300px;
-moz-column-gap:30px;
column-width:100px;
column-gap:30px;
width:550px;
height: 150px;
margin: 0 auto;
overflow-x: auto;
overflow-y: auto;
}
</style>
那么,如何让动态创建的 iddiv
随处可访问?提前感谢您的任何想法。