社区
JavaScript
帖子详情
js的location.href的问题
KoichiGeN
2010-02-21 10:18:20
我的zoomin的图片原来是zooms.gif
想写一段js代码,点击之后改图片为zoomins.gif,并发送get请求。我这样写的:
window.location.href="/test7/?tooltype=" + tooltype;
document.getElementById("zoomin").src = "images/zoomins.gif"; break;
但是图片无法改变显示。请问这是为什么呢?如果注释掉第一句,图片可以改变。
...全文
426
4
打赏
收藏
js的location.href的问题
我的zoomin的图片原来是zooms.gif 想写一段js代码,点击之后改图片为zoomins.gif,并发送get请求。我这样写的: window.location.href="/test7/?tooltype=" + tooltype; document.getElementById("zoomin").src = "images/zoomins.gif"; break; 但是图片无法改变显示。请问这是为什么呢?如果注释掉第一句,图片可以改变。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
KoichiGeN
2010-02-21
打赏
举报
回复
嗯。搞定了,谢谢呀!
挨踢直男
2010-02-21
打赏
举报
回复
document.getElementById("zoomin").src = "images/zoomins.gif"
这句别写在函数里面 写到函数外面单独运行
KoichiGeN
2010-02-21
打赏
举报
回复
呃,是这样的。但是我重新设定图片了呀。相对路径应该不变吧?
其它有什么好的发送get请求的方式吗?主要想用js发送一段get请求,所以重新定位了。
另外,url的“?”后面的内容也算新的页面吗?不是太理解这点
挨踢直男
2010-02-21
打赏
举报
回复
window.location.href="/test7/?tooltype=" + tooltype;
这样链接到新的网页上去了 还怎么显示
window.
location
.
href
的用法
javascript中的
location
.
href
有很多种用法,主要如下。 self.
location
.
href
="/url" 当前页面打开URL页面
location
.
href
="/url" 当前页面打开URL页面 windows.
location
.
href
="/url" 当前页面打开URL页面,前面三个用法相同。 this.
location
.
href
="/url" 当前页面打开URL页面 parent.
location
.
href
="/url" 在父页面打开新页面 top.
location
.
href
=
关于
js
中window.
location
.
href
,
location
.
href
,parent.
location
.
href
,top.
location
.
href
的用法
"window.
location
.
href
"、"
location
.
href
"是本页面跳转. "parent.
location
.
href
" 是上一层页面跳转. "top.
location
.
href
" 是最外层的页面跳转. 举例说明: 如果A,B,C,D都是html,D是C的iframe,C是B的iframe,B是A的iframe,如果D中
js
这样写 "window.
location
.
href
"、"
location
.
href
":D页面跳转 "parent.
location
.h
js
中
location
.
href
,parent.
location
.
href
,top.
location
.
href
的用法
window.
location
.
href
、
location
.
href
是本页面跳转 parent.
location
.
href
是上一层页面跳转 top.
location
.
href
是最外层的页面跳转 举例说明: 如果A,B,C,D都是html,D是C的iframe,C是B的iframe,B是A的iframe,如果D中
js
这写 window.
location
.
href
、
location
.
href
:D页面跳转 parent.
location
.
href
:C页面跳转 top.
location
.
href
:A页面跳转
关于
js
中"window.
location
.
href
"、"
location
.
href
"重定向
关于
js
中"window.
location
.
href
"、"
location
.
href
"、"parent.
location
.
href
"、"top.
location
.
href
"的用法 "window.
location
.
href
"、"
location
.
href
"是本页面跳转 "parent.
location
.
href
"是上一层页面跳转 "top.
location
.
href
"是最外层的页
window.
location
.
href
的用法(动态输出跳转)
javascript中的
location
.
href
有很多种用法,主要如下。 self.
location
.
href
="/url" 当前页面打开URL页面
location
.
href
="/url" 当前页面打开URL页面 windows.
location
.
href
="/url" 当前页面打开URL页面,前面三个用法相同。 this.
location
.
href
="/url" 当前页面打开UR
JavaScript
87,994
社区成员
224,697
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章