我將一些數據格式化爲表格。我想設置一個onclick按鈕,該按鈕將獲得該行中某個TD內的鏈接的URL,然後將結果加載到下面的一行中。這是一行的例子。假設表中沒有ID。獲取的密文,並在結果中追加新行
<tr>
<td>Title of something</td>
<td><a href="link_to_something.html">Link</></td>
<td><button onclick="load_file(this.??);">Show Page</button></td>
</tr>
JavaScript的需要:
function load_file(,) {
// get the url in the second <td>
// urlencode the url
// append a new <tr><td colspan="3"></td></tr> below
// load some_file.php and pass the variable (file_url) and value (urlencoded) using the .load method in JQuery and load the results into the newly appended <td>
}
我已經在JQuery的的.load方法讀了。如果TD沒有ID,是否可以加載結果?
我想我可以爲所有Table元素設置一個ID,如果這證明太沒有ID的困難,但只是試圖保持我的PHP腳本簡單,並與JQuery做「按需」的東西。
謝謝約翰。要給這個鏡頭並報告回來。 – TDave00 2011-02-24 06:27:51
工程很棒。謝謝! – TDave00 2011-02-24 06:47:36