2
我有一個問題,它是我試圖動態創建標籤,並設置文本的textarea,但問題是,我不能通過JavaScript動態增加標籤的大小,我已經發布了HTML和下面的JavaScript代碼: -無法增加javascript中動態創建標籤的寬度?
的JavaScript
function createLabel(){
var lbl = document.createElement("label");
lbl.id = "label2";
var tr = document.createElement("tr");
var lblText = document.getElementById("postbox").value;
lbl.innerHTML = lblText;
lbl.style.display = "block";
tr.appendChild(lbl);
tr.style.display = "block";
document.getElementById("postTd").appendChild(tr);
$("#label2").css("width", "50px;")
}
HTML: -
<div id="wrapper">
<a href="profile.php"><label id="label1" style="cursor:pointer;"><?php echo user_details('username'); ?></label></a>
<textarea id="postbox" rows="4" style="position: absolute; resize:none; margin-left:450px; margin-top:70px;" cols="70"></textarea>
<input type="submit" onclick="createLabel()" value="Post" style="position: absolute; margin-top:150px; margin-left:990px;" name="submit" />
<div id="hrln1" style="position:absolute; margin-top:150px; width:1050px; margin-left:0px;"><hr /></div>
<div id="postContainer">
<table id="postTable">
<td id="postTd">
</td>
</table>
</div>
首先,先生,你可以指導我,我應該如何發佈HTML代碼... –
嘿@tomalak請你請請告訴我你是怎麼做到的.. –
檢查此編輯問題格式http://stackoverflow.com/editing-help –