简单< div onclick ="">不在firefox中工作 [英] Simple <div onclick=""> not working in firefox

查看:66
本文介绍了简单< div onclick ="">不在firefox中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿那里,


我决定只创建一个100%的高度和宽度div,在背景标题图像上填充

空间,并添加一个onclick事件将

重定向到我的索引...似乎只在FireFox中工作,只是在IE中使用
。这是代码:


< div id =" headerimg">< div style =" width:100%;身高:100%;光标:

手; cursor:pointer;"

onclick =" top.location.href(''http://www.monamouchtim.com/'');">& nbsp;< / div>< / div>


这似乎在IE中工作正常,但不适用于Firefox。我是傻瓜还是

我错过了一些关于FireFox非常重要的东西吗?

Hey there,

I decided to just create a 100% height and width div that filled the
space over a background header image, and add an onclick event to
redirect to the my index... Doesn''t seem to work in FireFox only, just
in IE. Here''s the code:

<div id="headerimg"><div style="width: 100%; height: 100%; cursor:
hand; cursor: pointer;"
onclick="top.location.href(''http://www.monamouchtim.com/'');">&nbsp;</div></div>

This seems to work fine in IE, but doesn''t in Firefox. Am I stupid or
am I missing something really important about FireFox?

推荐答案

尝试取出函数调用结束时的半冒号?

CK


" Eric-Sebastien Lachance" < ES ******** @ gmail.com>在消息中写道

news:11 ********************** @ g14g2000cwa.googlegr oups.com ...
Try taking out the semi colon at the end of the function call?
CK

"Eric-Sebastien Lachance" <es********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
嘿那里,

我决定只创建一个100%的高度和宽度div,在背景标题图像上填充
空间,并添加一个onclick事件给
重定向到我的索引...似乎只在FireFox中工作,只是在IE浏览器中。这是代码:

< div id =" headerimg">< div style =" width:100%;身高:100%;光标:
手; cursor:pointer;"
onclick =" top.location.href(''http://www.monamouchtim.com/'');">& nbsp;< / div>< ; / div>

这似乎在IE中工作正常,但不在Firefox中。我是愚蠢还是
我错过了一些关于FireFox非常重要的东西?
Hey there,

I decided to just create a 100% height and width div that filled the
space over a background header image, and add an onclick event to
redirect to the my index... Doesn''t seem to work in FireFox only, just
in IE. Here''s the code:

<div id="headerimg"><div style="width: 100%; height: 100%; cursor:
hand; cursor: pointer;"
onclick="top.location.href(''http://www.monamouchtim.com/'');">&nbsp;</div></div>

This seems to work fine in IE, but doesn''t in Firefox. Am I stupid or
am I missing something really important about FireFox?



Chris Kettenbach尝试输入以下内容来帮助:
Chris Kettenbach tried to help by typing:
尝试在函数调用结束时取出半冒号?
CK
Try taking out the semi colon at the end of the function call?
CK




不幸的是,这似乎无法解决问题。 ..那是一个

php编码器反射;)



Unfortunately, that doesn''t seem to fix the problem... And that was a
php coder reflex ;)


Eric-Sebastien Lachance写道:
Eric-Sebastien Lachance wrote:
嘿那里,

我决定只创建一个100%高度和宽度的div,在背景标题图像上填充
空间,并添加一个onclick事件来重定向到我的索引...似乎只在FireFox中工作,只是在IE浏览器中。这是代码:

< div id =" headerimg">< div style =" width:100%;身高:100%;光标:


由于Firefox和Mozilla实现上述

风格的不同,你的div的大小差异很大 - 但是那个'对于CSS

小组进行讨论。

hand; cursor:pointer;"
onclick =" top.location.href(''http://www.monamouchtim.com/'');">& nbsp;< / div>< ; / div>

这似乎在IE中工作正常,但不在Firefox中。我是傻瓜还是
我错过了一些关于FireFox非常重要的东西?
Hey there,

I decided to just create a 100% height and width div that filled the
space over a background header image, and add an onclick event to
redirect to the my index... Doesn''t seem to work in FireFox only, just
in IE. Here''s the code:

<div id="headerimg"><div style="width: 100%; height: 100%; cursor:
Due to the differences in how Firefox and Mozilla implement the above
style, the size of your divs are quite different - but that''s for a CSS
group to discuss.
hand; cursor: pointer;"
onclick="top.location.href(''http://www.monamouchtim.com/'');">&nbsp;</div></div>

This seems to work fine in IE, but doesn''t in Firefox. Am I stupid or
am I missing something really important about FireFox?




是的:


工具 - > JavaScript控制台


它会告诉你top.location.href不是函数。使用


< ... onclick =" location.href(''http:...'');"> ...


终止分号符合JavaScript语法,

虽然在这种情况下不需要。


-

Rob



Yes:

Tools --> JavaScript Console

It will tell you that ''top.location.href is not a function''. Use

<... onclick="location.href(''http:...'');">...

The terminating semi-colon is in accordance with JavaScript syntax,
though not required in this case.

--
Rob


这篇关于简单&lt; div onclick =&quot;&quot;&gt;不在firefox中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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