"error on page"

F

frizzle

Depends on the browser,
in Internet Explorer for instance, you can double click
on the error icon: left-lower corner, and view the details ...
 
R

Randy Webb

Lee David said the following on 7/21/2005 4:46 PM:
How do you track down this to where the error actually is?

You read the error message. It states what the error is and what line it
is on. To see the error message, in IE, you double click the Yellow !,
in Mozilla you go Tools>Web Development>Javascript Console.
 
L

Lee David

Thank you. When I reopened the page it lead me directly to the "operator
error" (my mistake) of not knowing how to spell "document" correctly. Now I
just need to find out how to get the Netscape browser identified. This
didn't work:

if (document.layers)
{
alert("**testing** NS");
var ns4test = true;
var ie4test = false;
}

Nor did the more compact:
ns4test = document.layers?true:false;

Again, thanks for the quick response... I'll put my shoe down and the
monitor is safe again.

Lee
 
R

Randy Webb

Lee David said the following on 7/21/2005 6:36 PM:
Thank you. When I reopened the page it lead me directly to the "operator
error" (my mistake) of not knowing how to spell "document" correctly. Now I
just need to find out how to get the Netscape browser identified. This
didn't work:

Why does it matter if its Netscape, Mozilla, FunkyBrowser or
myBrowserThatIMadeUpTheName? You don't browser detect, you feature detect.
if (document.layers)
{
alert("**testing** NS");
var ns4test = true;
var ie4test = false;
}

Nor did the more compact:
ns4test = document.layers?true:false;

That actually "works", it just doesn't work the way you think it would.
Again, thanks for the quick response... I'll put my shoe down and the
monitor is safe again.

if (document.layers){
//use the document.layers collection
}

if (document.getElementByID){
//use the getElementByID method
}

if (document.all){
//use the document.all collection
}

And all that without caring what browser it was. This is covered in the
groups FAQ.

And please don't top-post.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
 
R

RobG

Lee David wrote:
[...]
Nor did the more compact:
ns4test = document.layers?true:false;

For the sake of the exercise:

var supportForLayers = !!document.layers;

The use of !! forces the result to be explicitly true or false and have
the right sense.


[...]
 
L

Lee David

For the sake of the exercise:
var supportForLayers = !!document.layers;

The use of !! forces the result to be explicitly true or false and have
the right sense.

I'm using <div> to enclose the text that I want to appear. I understand
that Layers is an older and not needed technology. However, the check for
it indicates the usage of NS which used totally different values than IE
does. Therefore, I'm assuming I could use the above and then have code like
this:

if (supportForLayers)
{
turn on the various <div> based on which object incurred the mouseover or
mouseout event using "show"
turn off the various <div> that are not applicable to the triggering event
using "hide"
}

if (supportForAll)
{
turn on the various <div> based on which object incurred the mouseover or
mouseout event using "visible"
turn off the various <div> that are not applicable to the triggering event
using "hidden"
}

Would I need something for Opera, Firefox or other modzilla browsers?

Thanks, Lee
 
L

Lee David

Why does it matter if its Netscape, Mozilla, FunkyBrowser or
myBrowserThatIMadeUpTheName? You don't browser detect, you feature detect.

Because specific browsers have specific and unique values such as Netscape's
"show" vs. the IE "visible."
That actually "works", it just doesn't work the way you think it would.

Could you elaborate on how it is working vs. how it would be expected to?
if (document.layers){
//use the document.layers collection
}

if (document.getElementByID){
//use the getElementByID method
}

if (document.all){
//use the document.all collection
}

And all that without caring what browser it was. This is covered in the
groups FAQ.

I've seen 4.15 and it doesn't give very much information. For example, how
to apply anything it says at all. Do you happen to know of a tutorial that
does explain it and give examples?

Thanks, Lee
 
L

Lee David

if (document.layers){
//use the document.layers collection
}

if (document.getElementByID){
//use the getElementByID method
}

if (document.all){
//use the document.all collection
}

BTW, I tested each of these under NS7.2 and they all returned false.

Thanks, Lee
 
R

RobG

----------------------------^

if ( document.getElementById ){

Case sensitivity's a bitch, eh?


[...]
 
R

RobG

Lee said:
I'm using <div> to enclose the text that I want to appear. I understand
that Layers is an older and not needed technology. However, the check for
it indicates the usage of NS which used totally different values than IE
does. Therefore, I'm assuming I could use the above and then have code like
this:

if (supportForLayers)
{
turn on the various <div> based on which object incurred the mouseover or
mouseout event using "show"
turn off the various <div> that are not applicable to the triggering event
using "hide"
}

if (supportForAll)
{
turn on the various <div> based on which object incurred the mouseover or
mouseout event using "visible"
turn off the various <div> that are not applicable to the triggering event
using "hidden"
}

That's the right strategy, only test for the most common choice first -
Communicator 4 represents perhaps 1:1000 web surfers, so do the test
that will be true for the vast majority of cases first.


function setVisibility ( el, state ) {
if ( el.style ) {
el.style.visibility = ('visible'==state)? 'visible' : 'hidden';
} else if ( el.visibility ) {
el.visibility = ('visible'==state)? 'show' : 'hide';
} else {
// Some other option?
}
}


If the above is called with:

setVisibility ( elementReference, 'visible' );

it will change the visibility property to visible or show. Anything
else and it will be changed to hidden or hide.

I don't have Communicator 4 handy so I can't test it, but it should be OK.
Would I need something for Opera, Firefox or other modzilla browsers?

No. The idea is to test for functionality, not browser.
 
L

Lee David

I want to thank you t h i s much. It works now and at
last I can move on to the next (to be discovered) problem!

Lee
 
R

Randy Webb

RobG said the following on 7/21/2005 11:44 PM:
----------------------------^

if ( document.getElementById ){

Case sensitivity's a bitch, eh?

Aint it though? I will have to smack myself on the hands for that one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top