window.location和opera [英] window.location and 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éconnexion</a></body>
</html>
"K. S." wrotethis 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é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é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éconnexion</a></body>
</html>
这篇关于window.location和opera的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!