<html>
<body>
<tr>
<td>
<a href="" id="al">video</a>
</td>
</tr>
<script language="JavaScript"> 
var rtspurl="baidu";
document.getElementById("al").href="'http://'+rtspurl+'.com'";
</script>
</body>
</html>想在javascipt里把字符串和变量给链接起来,代码如上所示
但不能实现我要的功能,链接不上
请高人指点

解决方案 »

  1.   

    document.getElementById("al").href="http://"+rtspurl+".com";  lz试试这个
      

  2.   

    document.getElementById("al").href='http://'+rtspurl+'.com';
      

  3.   

    document.getElementById("al").href='http://'+rtspurl+'.com';
      

  4.   

    al.href = "http://" + rtspurl + ".com";
      

  5.   

    document.getElementById("al").href='http://'+rtspurl+'.com';
      

  6.   

    al.href = "http://" + rtspurl + ".com";
    al.href = ‘http://’ + rtspurl + ‘.com’;
    这里单引号和双引号效果是一样的 都可以连接字符串
      

  7.   

    呵呵,我不是搞学这个的
    只是现在一个cgi程序里要用到这个