0

Web ページで ace エディター インスタンスを使用しています。

<div class="tabpage" id="tabscontent">
     <div class="ace_page" id="tabpage_1">
     </div>
</div>  

そして、私の JavaScript ファイルは、この div を ace エディター インスタンスとして初期化します。

var aceEditor = ace.edit("tabpage_1");
aceEditor.setTheme("ace/theme/textmate");
aceEditor.getSession().setMode(language);

tabpage_1ここで、このコードを使用してエディター インスタンスの上に配置されるように div を配置したいと思います。

function addUserCursor(editor, position, user, color) {
var page = document.getElementById("tabscontent");
var label = document.createElement("div");
label.setAttribute("id", editor+"-"+user);
label.setAttribute("position", "absolute");
label.setAttribute("top", "200px");
label.setAttribute("left", "200px");
label.setAttribute("background-color", color);
label.setAttribute("z-index", "10");
label.innerHTML = user;
page.appendChild(label);

}

しかし、これはそのエディターの上にある div にはなりません (スタイル属性は後で css に収集されます。これはテスト用です)。私が間違っていることを誰かが知っていますか?

4

1 に答える 1

1

label.setAttribute("z-index", "10");間違っているに違いないlabel.style.zIndex = 10;

于 2013-06-30T09:30:17.427 に答える