-2

次のスクリプトがありますが、機能していません。リンクを追加するにはどうすればよいですか? jno = "97856483"; dispTitle = "新しい本"; dispAuthor = "著者名";

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);  
4

2 に答える 2

4

見積もりを適切に開いたり閉じたりする必要があります。
それを試してください:

document.getElementById("addLink").innerHTML = "<a href='memaccountentry.php?isbn="+ url +"'>Add book</a>" ;   //This one just appends the word url.
于 2012-06-28T21:23:30.160 に答える
1

文字列を正しくフォーマットしていないようです。

これがあなたが望んでいたものではない場合、あなたは私を完全に混乱させます.

document.getElementById("addLink").innerHTML = "<a href='memaccountentry.php?isbn='" + url + ">Add book</a>";
于 2012-06-28T21:25:37.277 に答える