<a href= "javascript:window
来源:互联网 发布:现代网络女作家排行榜 编辑:程序博客网 时间:2024/04/29 04:24
我有一个button,想通点该button打开一个连接地址,或用 <a href= "javascript:window.location= '连接地址 '; "> <input type= "button " ... /> </a> ,连接中包含空格和&,
问题:1.在IE中打不开连接地址,FireFox 下正常,我用的是 <a> ,非button的onclick事件
2.为什么在safari下,参数是乱码
连接地址例如:FF:
http://www.xxx.net/service/forums/newthread.asp?title=Cute%20FTP%20Professional%208.0.7&p=%D0%E9%C4%E2%D6%F7%BB%FA
Safari:
http://www.xxx.net/service/forums/newthread.asp?title=Cute%20FTP%20Professional%208.0.7&p=???????
我的document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
回答===========================
不明白为什么你会要在Button外面加A标签,Button的Onclick的事件会比A的href好用很多。如果你一定想用这种方法来完成功能,这个Button最好不要放在Form里,要不可能会运行Form的Submit事件。
如果你一定要这样完成,建议写一个函数:
function test() {
javascript:window.location = 'http://www....D0%E9%C4%E2%D6%F7%BB%FA ';
}
然后在A的href中写:“javascript:test();”来调用它。
如果你要动态参数,一定要用encodeURIComponent来对参数进行编码,要不中间的特殊字符可能会打断URL的解析。
===================================
<a id= 'jumpLink ' href= "javascript:window.location= '连接地址 '; "> </a> <input type= "button " onClick= 'document.all.jumpLink.click(); ' ... />
- <a href= "javascript:window
- <a href="javascript:
- javascript window.location.href
- JavaScript--window.loaction.href
- <a href="#">与<a href="javascript:void(0)">
- <a href="#">和<a href="javascript:void(0);">
- <a href="javascript: ;">和<a href="#">
- a href = "javascript:;"和 a href = "#"
- a标签href="javascript:void(0)" href="javascript:;"
- <a href="javascript:;">中href中的javascript:;的作用
- <a href=javascript:alert()>aaa</a>
- <a href="" />,<a href="#" />与<a href="javascript:void(0)" />的区别
- <a> href=javascript://与href="#"的区别
- window.location.href = window.location.href 跳转无反应 a超链接onclick事件写法
- a href=#与 a href=javascript:void(0) 的区别,以及location.href含义
- a href=#与 a href=javascript:void(0) 的区别,以及location.href含义
- a href="#"、href=”javascript:void(0);”与href=”javascript:;”区别
- <a href="javascript:void(0)" 使用方法
- C# 窗体点击关闭按钮时最小化到托盘
- 强制转换
- NetDiskdll.dll中MD5File函数使用时遇到的问题
- javascript:"伪协议
- 长大了~~~~~
- <a href= "javascript:window
- Java Web 框架 Tapestry
- vs2003 远程调试
- 数据库连接,读取
- 正则表达式语法
- JavaScript中下拉框操作
- Windows与Unix程序内存空间差别
- [双语阅读]最古老女性雕像出土“维纳斯”丰乳肥臀
- 感人的故事