我有下面的腳本,這是行不通的。我該如何添加鏈接? jno =「97856483」; dispTitle =「新書」; dispAuthor =「authorname」;從javascript添加一個鏈接到php腳本
document.getElementById('popups').innerHTML = '';
//Add link to add this book:
var url = encodeURIComponent(jno) + "&tt=" + encodeURIComponent(dispTitle) + "&at=" + encodeURIComponent(dispAuthor);
//document.writeln(url);
document.getElementById("addLink").innerHTML = "<a href='memaccountentry.php?isbn='+ url>Add book</a>" ; //This one just appends the word url.
//window.location.href = 'memaccountentry.php?isbn=' +jno +'&tt=' +dispTitle+'&at=' +dispAuthor; //I know this is working, but not a right way to do.
//I need to put a href link to go to the next page.
//ajax.open('GET', 'memaccountentry.php?isbn=' +jno +'&tt=' +dispTitle+'&at=' +dispAuthor', true);
在memaccountentry之前有一個單引號,它永遠不會關閉。 –
@ Sonal-Patelia:我修好了,謝謝。 – Jocelyn
謝謝..現在我明白了。我正在尋找這個簡單的東西幾個小時..一票! –