您好我仍然在學習Jquery和訪問表單元素有問題。我的腳本打開一個div,然後用預先寫好的html表格填充它。我使用ajax來獲取表單和jQuery。這一切工作正常,我可以看到我的表格在其中的div框。問題是我想填充innerhtml表單,我已經嘗試過javascript和jquery,但是我的代碼都不會填充文本框。訪問與JQuery的innerhtml
divbox = "fixedbox"
// open up the div
setdiv(divbox,100,600,800)
// JQ - ajax
$(document).ready(function(){
$("#" + divbox).load("../customer_rm/display_email_send.php");
});
// neither of these will produce any text
document.getElementById('mailcc').value = "test";
$("#mailcc").val("test");
如果需要,這裏是表格。任何人都可以提供任何建議,我正在做什麼?
<?php
echo "
<style type='text/css'>
table {border: 1px solid black}
td, tr {border: 0}
.bdr {
border: 4px solid black ;
}
.white {
background-color:#FFF ;
}
</style>
<div align='center'>
<br><br />
<table width='700' border='2' bgcolor='#CCCCCC'>
<form id = 'mail' name='mail' >
<tr >
<td width='20'> </td>
<td width='50'> </td>
<td width='50'> </td>
<td > </td>
<td width='20' > </td>
</tr>
<tr>
<td> </td>
<td rowspan='3'>
<input type='button'id='send' value='Send'
style='width:60px; height:40px '
/><hr>
<input type='button' value='Close'
style='width:60px; height:20px ' onclick='fadeout()'
/>
</td>
<td><input type='button' value='To :' /></td>
<td><input type='text' class='white' id='mailto' size='80' /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type='button' value='Cc :' /></td>
<td><input type='text' class='white' id='mailcc' size='80' /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type='button' value='Bcc :' /></td>
<td><input type='text' class='white' id='mailbcc' size='80' /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan='3'>
<textarea name='mail_body' id='mail_body' class='white'
style='height:380px; width:600px; bgcolor:#fff ' >
</textarea>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</form>
</table>
</div>
" ;
這是div框
#fixedbox {
position:absolute ;
width: 20px;
height: 20px;
top: 40px ;
border: 2px solid black;
background-color:#CCC;
left:50% ;
margin-left:-300px;
visibility:hidden ;
overflow:hidden ;
}
感謝您抽出寶貴時間看看這個給我,歡呼 – Mick 2010-09-18 10:51:16