我想從PHP文件用戶的內容與load()
功能,並顯示在其工作正常但是同樣的過程textarea的將無法正常工作,如果用戶鍵入的東西在texarea事先。任何人都有解決辦法嗎?jQuery的負載()無法正常運轉的預期textarea的
例如:在textarea中鍵入內容並單擊不會更改texarea內容的鏈接。
在此先感謝
HTML
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function show_content(display_field, id)
{
$('#' + display_field).load('data.php?id=' + id);
}
</script>
<a href="#nogo" onClick="show_content('content_area', '1')" title="View">User 1</a>
<a href="#nogo" onClick="show_content('content_area', '2')" title="View">User 2</a>
<a href="#nogo" onClick="show_content('content_area', '3')" title="View">User 3</a>
<textarea id="content_area" rows="10" cols="10"></textarea>
PHP
<?php
$content[1] = 'This belongs to User 1';
$content[2] = 'This belongs to User 2';
$content[3] = 'This belongs to User 3';
echo $content[$_GET['id']];
?>
優秀。非常感謝你的工作非常好。 – BentCoder