473,387 Members | 1,700 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.

Want to create a wrapper for code that detects presence of IE or Netscape

Hello - I have this DHTML calendar that displays about 10 pixels off
its target in Netscape 7.0 -- from the script layer I have the block
of code identified that positions the calender on the screen. I was
thinking if I could write a wrapper around this that would execute two
different versions depending on which browser is coming in... for now
I am only interested in all versions of IE and NS 7.0 (haven't tested
it on earlier versions of NS, but would like to understand the flag
adjustments). Thanks for anyone's help!! :)
Jul 20 '05 #1
3 1372
In article <19**************************@posting.google.com >,
ma******@yahoo.com enlightened us with...
Hello - I have this DHTML calendar that displays about 10 pixels off
its target in Netscape 7.0 -- from the script layer I have the block
of code identified that positions the calender on the screen. I was
thinking if I could write a wrapper around this that would execute two
different versions depending on which browser is coming in... for now
I am only interested in all versions of IE and NS 7.0 (haven't tested
it on earlier versions of NS, but would like to understand the flag
adjustments). Thanks for anyone's help!! :)


I've had similar problems with pixels. I stopped using them.

As a workaround and only if only IE and NN7 are the only browsers, the
following will work. (note: opera supports document.all)

if (document.all)
{
// IE
}
else
{
NN
}

HTH

--
~kaeli~
I do whatever my Rice Krispies tell me to.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2
kaeli <ti******@NOSPAM.comcast.net> writes:
As a workaround and only if only IE and NN7 are the only browsers, the
following will work. (note: opera supports document.all)
Some versions of Opera. Some of them only sometimes. And so several
other browsers too.
if (document.all)
{
// IE


Bad idea. As you say, it works if the *only* browsers they will view
the page are the *currently avilable* versions of IE and Mozilla.

Most other current browsers, and potentially a lot of future browsers,
will fail. So, don't go there, it's bound to come back and bite you in
the posterior.

The best way (IMNSHO[1]) is to
1) Use a doctype that triggers standards mode. That will let IE 6 show
the page according to the CSS 1 standard, instead of being bugwards
compatible with the highly deprected IE 4. In most cases, IE 6 and
Mozilla (and Opera and other standards supporting browsers) will then
show the pages identically.

I would use HTML 4.01 with en URL. Read more:
<URL:http://msdn.microsoft.com/library/en-us/dnie60/html/cssenhancements.asp>
<URL:http://mozilla.org/docs/web-developer/quirks/doctypes.html>
<URL:http://www.opera.com/docs/specs/doctype/>

2) Where the browsers still differ in rendering, make the page so that
it looks correct in Mozilla. Then add the changes needed to make it
look the same in IE, but wrap them in IE's conditional comments:
<!--[if IE]> blah blah fixes IE blah <![end if]-->
To all other browsers, it looks like a comment. To IE 5+, it is treated
as normal content.

<URL:http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp>

Normally, those two steps will be enough to fix any problems you might
have with IE.

/L
[1] in my, not so humble, opinion.
--
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 #3
In article <d6**********@hotpop.com>, lr*@hotpop.com enlightened us
with...

2) Where the browsers still differ in rendering, make the page so that
it looks correct in Mozilla. Then add the changes needed to make it
look the same in IE, but wrap them in IE's conditional comments:
<!--[if IE]> blah blah fixes IE blah <![end if]-->
To all other browsers, it looks like a comment. To IE 5+, it is treated
as normal content.

<URL:http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp>


That is SO cool. :)

Thanks for sharing.

--
--
~kaeli~
If a turtle doesn't have a shell, is he homeless or naked?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4

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

Similar topics

4
by: Robert Dickow | last post by:
This code works perfectly in IExplorer, but in exactly the same context does not work at all in Netscape 7.x. <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"> <!-- if...
9
by: jab | last post by:
Je veux lier (join) une table qui se trouve dans une database avec une qui se trouve dans une autre database. Les 2 databases sont sur le même serveur en l'occurence DB2/NT 7.2.9. J'ai créé un...
1
by: bennett | last post by:
At http://www.brainjammer.com/testing/validator_test.aspx I have a text field where you can enter text, and a button where if you click the button, it sets the value of a label below it, to...
8
by: Amanda H. | last post by:
Hi guys, I just started switching my site over to tableless css, and I'm using a very lovely, transparent PNG-24 image. I have been trying to figure out if there is any way to replace an image...
3
by: fyi85 | last post by:
I am trying to create a server on the same machine running the same instance. This is v8.1.5 on Windows 2003 Server. The instance is set to FEDERATED=YES The server will be created for database...
3
by: zgh1970 | last post by:
Hi, All, We have a database on db2 udb aix. The database has federated server to db2 mainframe. Now We have already catalog database of db2/400 on the db2 UDB aix server. I tried to create new...
3
by: bobc | last post by:
Using SQL Server 2000... I wrote a wrapper to call a sub proc (code provided below). The intended varchar value returned in the output parameter of each proc is a string implementation of an...
13
by: bobc | last post by:
In my stored procedure, I want to parse @ArrayOfDays into @d1 through @d5. @ArrayOfDays is a varchar input parameter containing, for example, "1.7.21.25.60." - five elements. Most active...
5
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... I've got a .Net client to a soap service that works for the most part, but there are a couple of things I'd like to improve: 1) the first request to the client wrapper always takes...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.