window.location和opera [英] window.location and opera

查看:86
本文介绍了window.location和opera的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


此代码在IE中运行正常,但在Opera中不起作用。页面只是

重新加载到歌剧中的test.html#


有人可以帮忙吗?谢谢。


------------------------------------ -----------------------------------


< html> ;

< head>< script language =" JavaScript" type =" text / JavaScript">

function disco(){

if(确认(''你确定吗?')){

window.location =" http://wwww.google.com" ;;

}

}

< /脚本>

< / head>

< body>

< a href ="#" onClick =" javascript :disco()"> D& eacute; connexion< / a>< / body>

< / html>

解决方案

" K. S."写了

这段代码在IE中运行正常但在opera中不起作用。该页面只是在歌剧中重新加载到test.html。

< html>
< head>< script language =" JavaScript" type =" text / JavaScript">
function disco(){
if(confirm(''你确定吗?')){
window.location =" http: //wwww.google.com" ;;


尝试直接设置位置'的href属性:

window.location.href =" http://wwww.google.com" ;;

}
}
< / script>
< / head>
< body>
< a href =" ;#"的onClick = QUOT;的JavaScript的 的:迪斯科()"> d&安培; eacute; Connexion公司< / A>


onclick =" disco();"


没有javascript :比特,最好带有结尾分号,用于

礼貌。

< / body>< / html>




我没有歌剧,但它总是一样的小东西..

HTH

Ivo


ķ。 S.写道:

大家好,

这段代码在IE中工作正常,但在Opera中不起作用。页面只是
重新加载到歌剧中的test.html#

任何人都可以帮忙吗?谢谢。

---------------------------------------- -------------------------------

< html>
< head> ;< script language =" JavaScript" type =" text / JavaScript">
function disco(){
if(confirm(''你确定吗?')){
window.location =" http: //wwww.google.com" ;;
}
}
< / script>
< / head>
< body>
< ; a href ="#" onClick =" javascript :disco()"> D& eacute; connexion< / a>< / body>
< / html>



可能是因为你没有从onclick返回false。此外,你

不需要javascript :这也可能是Opera的一部分

使用它:


< a href =" noScript.html" onclick =" disco(); return false"> .........< / a>


K. S.写道:

大家好,

这段代码在IE中工作正常,但在Opera中不起作用。页面只是
重新加载到歌剧中的test.html#

任何人都可以帮忙吗?谢谢。

---------------------------------------- -------------------------------

< html>
< head> ;< script language =" JavaScript" type =" text / JavaScript">
function disco(){
if(确认(''你确定吗?'))


window .confirm方法需要两个参数


函数disco(){

if(确认(''你确定吗?'','''')) {............................................................. br />}
< / script>
< / head>
< body>
< a href ="#" onClick =" javascript :disco()"> D& eacute; connexion< / a>< / body>
< / html>


hi guys,

this code works fine in IE but doesnot work in opera. the page just
reloads to test.html# in opera.

can anyone help? thanks.

-----------------------------------------------------------------------

<html>
<head><script language="JavaScript" type="text/JavaScript">
function disco() {
if( confirm(''are you sure?'') ) {
window.location="http://wwww.google.com";
}
}
</script>
</head>
<body>
<a href="#" onClick="javascript:disco()">D&eacute;connexion</a></body>
</html>

解决方案

"K. S." wrote

this code works fine in IE but doesnot work in opera. the page just
reloads to test.html# in opera.

<html>
<head><script language="JavaScript" type="text/JavaScript">
function disco() {
if( confirm(''are you sure?'') ) {
window.location="http://wwww.google.com";
Try setting the location''s href property directly:
window.location.href="http://wwww.google.com";
}
}
</script>
</head>
<body>
<a href="#" onClick="javascript:disco()">D&eacute;connexion</a>
onclick="disco();"

without the "javascript:" bit and preferably with an ending semicolon for
good manners.
</body></html>



I don''t have opera but it ''s always the same little things..
HTH
Ivo


K. S. wrote:

hi guys,

this code works fine in IE but doesnot work in opera. the page just
reloads to test.html# in opera.

can anyone help? thanks.

-----------------------------------------------------------------------

<html>
<head><script language="JavaScript" type="text/JavaScript">
function disco() {
if( confirm(''are you sure?'') ) {
window.location="http://wwww.google.com";
}
}
</script>
</head>
<body>
<a href="#" onClick="javascript:disco()">D&eacute;connexion</a></body>
</html>



Probably because you are not returning false from the onclick. Also, you
do not need the javascript: and that may also be part of Opera not
working with it:

<a href="noScript.html" onclick="disco();return false">.........</a>


K. S. wrote:

hi guys,

this code works fine in IE but doesnot work in opera. the page just
reloads to test.html# in opera.

can anyone help? thanks.

-----------------------------------------------------------------------

<html>
<head><script language="JavaScript" type="text/JavaScript">
function disco() {
if( confirm(''are you sure?'') )
window.confirm method requires two arguments

function disco(){
if(confirm(''are you sure?'','''') ){.....

Mick

{ window.location="http://wwww.google.com";
}
}
</script>
</head>
<body>
<a href="#" onClick="javascript:disco()">D&eacute;connexion</a></body>
</html>



这篇关于window.location和opera的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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