http://v.t.sina.com.cn/share/share.php?title='+encodeURIComponent(document.title)+' 我想访问这个网址,但是title后单引号里的无法运算,我想让+ +之间运算出来再赋值给title,怎么解决??
这个用js来实现比较好,直接修改a标签的href属性
例如:
<a href="#" id="aa">123</a>
-----------------------------------------
var newHref = 你要的值
$('#aa').attr("href",newHref )
例如:
<a href="#" id="aa">123</a>
-----------------------------------------
var newHref = 你要的值
$('#aa').attr("href",newHref )
温馨提示:答案为网友推荐,仅供参考
第1个回答 2011-05-04
location.href = ''<%=encodeURIComponent(document.title)%>
第2个回答 2011-05-04
<%= encodeURIComponent(document.title) %>追问
朋友,我在运行时出现:当前上下文中不存在名称“encodeURIComponent”错误,这代码用不用单引号?
追答你这个方法是什么方法
是后台的还是 前台
第3个回答 2011-05-04
location.href = ''+encodeURIComponent(document.title);