0
我的网站项目存在另一个问题。确定这里是我的问题...
从javascript函数向另一个javascript函数发送动态生成的值
<script>
function getTopArtist(){
if (window.XMLHttpRequest){
topartist = new XMLHttpRequest();
}
else{
topartist = new ActiveXObject("Microsoft.XMLHTTP");
}
topartist.onreadystatechange=function(){
try{
if (topartist.readyState==4 && topartist.status==200){
var ArtistDetails = topartist.responseXML.documentElement.getElementsByTagName("artist");
for(i=0;i<=2;i++){
myartistname = ArtistDetails[i].getElementsByTagName('name')[0].firstChild.nodeValue;
alert(myartistname)
document.getElementById('topartistdiv').innerHTML+='<a href="javascript:getAlbums(this is the proble here);">Albums</a>';
}
}
catch(er){
alert("Oops something went wrong!");
}
}
topartist.open("GET","http://localhost/test/topartist.php",true);
topartist.send(null);
}
</script>
我的问题是在第17行,当我试图把艺术家姓名括号里面的话,我可以将它们发送给另一个函数。所以我们假设它提醒Beyonce
我希望链接是这样的。
javascript:getAlbums('Beyonce');
我想它与特殊字符有关,但我无法弄清楚。任何帮助将不胜感激。
会给我一个意外的标记catch错误的铬。 – sam 2011-05-10 12:32:06