469,898 Members | 1,837 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

working in Netsc6 and ie 6 but not in Opera7.21

Hi,
I am new to Opera and I am quite surprised. I opened the javascript console:
nothing.
Nothing appears except the bargroung image in opera.
<SCRIPT LANGUAGE="JavaScript">
var input = getCookieData("webJPD");
var hello = input.substring(0, input.indexOf("|"))
var lang = input.substring( input.indexOf("|") + 1, input.length)

if(input){
if(lang == "francais"){
document.write("<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Heureux de
vous
revoir</p><p></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;" + hello + "</p>");
setTimeout('location.replace("paintings5.htm");', 5000)
}

if(lang == "english"){
document.write("<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Good to see
you
again</p><p></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;" + hello + "</p>");
setTimeout('location.replace("paintings5.htm");', 5000)
}
}else{
var texte = '<form name="R"><p>First name:<input type="text" name="T1"
size="20"></p>'
texte += '<p>Français:<input type="radio" value="V1" name="R1"
onClick="setCookie(document.R.T1.value, \'francais\')"></p>'
texte += '<p>English:<input type="radio" value="V2" name="R1"
onClick="setCookie(document.R.T1.value, \'english\')"></p></form>'
texte += '<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Veuillez indiquer
votre préférence SVP.</p>'
texte += '<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Please check for
your prefered language.</p>'
texte += '<p>&nbsp;</p><p>Merci - Thank you</p>'
texte += '<p>&nbsp;</p><p></p>'
document.writeln(texte);
}
</script>
Jul 20 '05 #1
3 1227
"Québec" <jp**@vidn.ca> writes:
I am new to Opera and I am quite surprised. I opened the javascript console:
nothing.
Nothing appears except the bargroung image in opera.
Then there is probably some error in the logic, not in the code.
<SCRIPT LANGUAGE="JavaScript">
var input = getCookieData("webJPD");


insert:
alert([input,typeof input,!!input]);
and see what it gives.
If input=="", then the result is
,string,false
That would indeed make nothing happen because of the if(input),
but it would still work for the substring operations. If it gives
some other result, but still with "false" at the end, then that
is why nothing is written.

Notice that Opera is strict in requireing, e g., correct dates on
cookies. Your cookie might have been refused because it is invalid. IE
is much more forgiving (some would say too much). I don't know about
Mozilla.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:d6**********@hotpop.com...
"Québec" <jp**@vidn.ca> writes:
I am new to Opera and I am quite surprised. I opened the javascript console: nothing.
Nothing appears except the bargroung image in opera.


Then there is probably some error in the logic, not in the code.
<SCRIPT LANGUAGE="JavaScript">
var input = getCookieData("webJPD");


insert:
alert([input,typeof input,!!input]);
and see what it gives.
If input=="", then the result is
,string,false
That would indeed make nothing happen because of the if(input),
but it would still work for the substring operations. If it gives
some other result, but still with "false" at the end, then that
is why nothing is written.

Notice that Opera is strict in requireing, e g., correct dates on
cookies. Your cookie might have been refused because it is invalid. IE
is much more forgiving (some would say too much). I don't know about
Mozilla.

I took off all the ifs

Inline script thread
Error:
name: ReferenceError
message: Statement on line 2: Reference to undefined variable: No such
variable 'getCookieData'
Backtrace:
Line 2 of inline#1 script in file://localhost/C:/Documents and
Settings/Jean Pierre/Desktop/testOpera.html
var input = getCookieData("webJPD");
Jul 20 '05 #3
I get it.

FPage has added a head and body tag.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Mullin Yu | last post: by
5 posts views Thread by Martin Heuckeroth | last post: by
5 posts views Thread by tshad | last post: by
8 posts views Thread by jojobar | last post: by
2 posts views Thread by Don | last post: by
4 posts views Thread by qbproger | last post: by
3 posts views Thread by Jason Huang | last post: by
reply views Thread by WORKING IN FAITH | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.