473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problems with Opera

In http://www.writeonwhidbey.org/_private/ssi/ssitest.html I have a simple
function

<script language="JavaScript1.2" style="text/javascript">
<!--
function checkLocation() {
if (navigator.userAgent.indexOf("Opera")!=-1) type="OP"
else if (document.all) type="IE" // ie 4 & up
else type="XX"
if (type=="IE")
moveNav.style.pixelTop=document.documentElement.sc rollTop
setTimeout("checkLocation()",5);
}
//-->
</script>

This is suppose to keep the Nav bar at the top of an IE browser. (Yes, it
wobbles a little bit, but what can I do?)

With most other browsers, the Nav Bar stays nice and stationary at the top,
thanks to a nice CSS solution. However, with Opera (at least Opera 7.54 that
I have) the nav bar wobbles a bit like I would expect it to in IE, but still
it gets hidden under most scrolling situations. What's the cure for Opera?

TIA

p/s/ I also tried:
if (navigator.userAgent.indexOf("Opera")!=-1
&& document.getElementById) type="OP";

but did the same thing.

Jul 23 '05 #1
4 1461
On 18/04/2005 18:30, Bob Richardson wrote:

[snip]
<script language="JavaScript1.2" style="text/javascript">
Specifying the language attribute is at best, redundant. Specifying
the language attribute as JavaScript1.2 can be positively dangerous as
far as reliable execution is concerned. Remove it.
<!--
Remove the SGML comment delimiters. They are unnecessary (have been
for years).

[snip]
if (type=="IE")


If you really want this executed by IE only, then use conditional
comments (either JScript, or HTML) to hide the code from other user
agents. It is far more reliable than browser detection. You can search
the MSDN Library (<URL:http://msdn.microsoft.com/>) for both.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
After reading up on Conditional Comments, it appeared that this coding would
work, allowing the JS to work only with IE 5 and up.

<!--[if IE gte 5]>
<SCRIPT LANGUAGE="Javascript">
function checkLocation() {
moveNav.style.pixelTop=document.documentElement.sc rollTop
setTimeout("checkLocation()",5);
}
</SCRIPT>
<![endif]-->

Works for NS and Firefox. In IE 6 "<!-- ->" appears at the top of
the nav bar, and in Opera, the Nav bar scrolls up when you scroll down!!
What am I missing!
"Michael Winter" <m.******@blueyonder.co.invalid> wrote in message
news:ou*****************@text.news.blueyonder.co.u k...
On 18/04/2005 18:30, Bob Richardson wrote:

[snip]
<script language="JavaScript1.2" style="text/javascript">


Specifying the language attribute is at best, redundant. Specifying the
language attribute as JavaScript1.2 can be positively dangerous as far as
reliable execution is concerned. Remove it.
<!--


Remove the SGML comment delimiters. They are unnecessary (have been for
years).

[snip]
if (type=="IE")


If you really want this executed by IE only, then use conditional comments
(either JScript, or HTML) to hide the code from other user agents. It is
far more reliable than browser detection. You can search the MSDN Library
(<URL:http://msdn.microsoft.com/>) for both.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Jul 23 '05 #3
I see I misplaced the gte. This coding still does not work. Opera sees it
and it appears that IE doesn't!!

<!--[if gte IE 5]>
<SCRIPT LANGUAGE="Javascript">
function checkLocation() {
moveNav.style.pixelTop=document.documentElement.sc rollTop
setTimeout("checkLocation()",5*);
}
</SCRIPT>
<![endif]-->

"Bob Richardson" <bobr at whidbey dot com> wrote in message
news:Wb********************@whidbeytel.com...
After reading up on Conditional Comments, it appeared that this coding
would work, allowing the JS to work only with IE 5 and up.

<!--[if IE gte 5]>
<SCRIPT LANGUAGE="Javascript">
function checkLocation() {
moveNav.style.pixelTop=document.documentElement.sc rollTop
setTimeout("checkLocation()",5);
}
</SCRIPT>
<![endif]-->

Works for NS and Firefox. In IE 6 "<!-- ->" appears at the top of
the nav bar, and in Opera, the Nav bar scrolls up when you scroll down!!
What am I missing!
"Michael Winter" <m.******@blueyonder.co.invalid> wrote in message
news:ou*****************@text.news.blueyonder.co.u k...
On 18/04/2005 18:30, Bob Richardson wrote:

[snip]
<script language="JavaScript1.2" style="text/javascript">


Specifying the language attribute is at best, redundant. Specifying the
language attribute as JavaScript1.2 can be positively dangerous as far as
reliable execution is concerned. Remove it.
<!--


Remove the SGML comment delimiters. They are unnecessary (have been for
years).

[snip]
if (type=="IE")


If you really want this executed by IE only, then use conditional
comments (either JScript, or HTML) to hide the code from other user
agents. It is far more reliable than browser detection. You can search
the MSDN Library (<URL:http://msdn.microsoft.com/>) for both.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


Jul 23 '05 #4
Bob Richardson <bobr at whidbey dot com> wrote in message
news:uK********************@whidbeytel.com...
I see I misplaced the gte. This coding still does not work. Opera sees it
and it appears that IE doesn't!!

<!--[if gte IE 5]>
<SCRIPT LANGUAGE="Javascript">
function checkLocation() {
moveNav.style.pixelTop=document.documentElement.sc rollTop
setTimeout("checkLocation()",5*);
}
</SCRIPT>
<![endif]-->


Opera 7.54 does not "see" this code as it is effectively within conventional
comments. If you enable error reporting, you will see this causes an error
when the non-existent function is called onload:

<body onLoad="checkLocation()">

Having said that, It appears that you have just trashed the code. Perhaps
for the best...
--
Stephen Chalmers


Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Phong Ho | last post by:
Hi everyone, I am using PHP and MySQL to create a dynamic website. Using MS Internet Explorer to test my website, everything works fine. When I use Netscape and Opera to test my work, I have...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
6
by: Dr.Bob | last post by:
Dear group, I made a 3 column design, centered in the middle, and #1 overlaps #2. To start, it was so much a hell to get this combination (3 columns, centering and stacking) right in IE + FF + OP...
3
by: eternalD3 | last post by:
Hi, I have a problem to get this working on Opera 7.x+. This does not need to work on older Opera browsers There are problems on rendering the sub-level navigation. It aligns right on Firefox...
8
by: Bob Richardson | last post by:
After making corrections, and passing the WC3 validation checks for the web page and the CSS, I'm still having problems ... only with Opera (7.54 and 8.0) at: ...
32
by: jp29 | last post by:
My take on problems composing, serving and rendering XHTML documents/web pages: 1. Typical conscientious web authors are producing XHTML documents (Web pages) that feature valid Markup and with...
1
by: cwdjrxyz | last post by:
I am now writing many new pages in xhtml 1.1. They are served as true xhtml by setting the mime type of the server to application/xhtml+xml for the .xhtml extension. Since IE6 and some earlier...
2
by: Amanda | last post by:
please take a look at: shannon.amandadevries.com 1. in firefox, the 'content' div should be starting on the right-hand side of the menublock, not all the way down at the 'copyrightblock'....
5
by: IndependentDreams | last post by:
This is a java script code that will make it snow on your page. My problem is that it works just fine in IE and Opera, but doesn't work in Fire Fox or Safari. Here is the code. If you have any idea...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.