html链接不起作用href javascript参数太长 [英] html link does not work href javascript parameter is too long

查看:334
本文介绍了html链接不起作用href javascript参数太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < a href =javascript:change('page_details_1','time,restime \\\
1387519869249,1196\\\
1387519906965,1368\\\
....... ')>< img src =expand.jpgalt =expand / collapseid =page_details_1_image>< / a>

在href中我调用了一个javascript函数change。第二个参数\\\
1387519869249,1196\\\
1387519906965,1368\\\
....是一个很长度为5070个字符,但在5052个字符处链接工作。

是否有可以通过href的字符数量限制?数据用于生成趋势如果存在这样的限制,那么将这些信息传递给javascript函数的最佳方式是什么?

试试 p>

 < a href =javascript:void(0);onclick =change('page_details_1 , '时间,restime\\\
......');返回false;>< img src =expand.jpgalt =expand / collapseid =page_details_1_image>< / a>

这样您的网址就不会太长。


<a href="javascript:change('page_details_1','time,restime\n1387519869249,1196\n1387519906965,1368\n........')><img src="expand.jpg" alt="expand/collapse" id="page_details_1_image"></a>

in href i am calling a javascript function "change". The second parameter "\n1387519869249,1196\n1387519906965,1368\n...." is a very long value about 5070 characters.but at 5052 characters the link works.

Is there a limit to number of characters that can pass through href? the data is used to generate trend graph . If there is such a limitation what would be the best way to pass such info to javascript function?

解决方案

Try

<a href="javascript:void(0);" onclick="change('page_details_1','time,restime\n......'); return false;"><img src="expand.jpg" alt="expand/collapse" id="page_details_1_image"></a>

This way your URL isn't overly long.

这篇关于html链接不起作用href javascript参数太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆