use*_*310 0 javascript hyperlink
这让我有点疯狂.Javascript链接应该触发函数来填充div.但不行.
JS
function showNotes(notes,id) {
var notes = '<form action="editnotes.php" method="post"><textarea>'+notes+'</textarea><input type="hidden" name="id" value="'+id+'"><input type="submit" name="submit" value="Save Notes"></form>';
var target = 'notebox';
alert(id);
document.getElementById(target).innerHTML = notes;
return false;
}
Run Code Online (Sandbox Code Playgroud)
HTML
<a href='#' onclick='showNotes('hi there','143');'><small>Show Notes</small></a>
<div id="notebox"></div>
Run Code Online (Sandbox Code Playgroud)
将onclick属性值括在双引号中,因此单引号指定字符串中的字符串.
onclick="showNotes('hi there','143');"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
146 次 |
| 最近记录: |