ECS-L Home Automation and Security Archives
  learn more | view messages for this month | NetBloc® | terms of use | search

Google
 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects

Subject:
From:
Date:
RE: [ECS] OT:Quick Java question
Michael David
Thu, 20 Jul 2000 05:29:52 -0400
Thu, 20 Jul 2000 05:29:52 -0400
Hi David!

I decided to abandon the three-way browser detection approach, and go with
the “If MSIE browser greater that v.4 do this, if not do that” approach.  I
also figured out a way to do it such my styles still apply, so this link
color changes on hover like the rest of the links:

<script>
<!--
if ((navigator.appVersion.indexOf("MSIE") > 0)
  && (parseInt(navigator.appVersion) >= 4))
       {
        document.write("<A
href='javascript:window.external.AddFavorite(location.href,
document.title)'>Add this page to your favorites</A>");
       }
else
       {
        document.write("<B>Hit Control-D to Bookmark this page!<B>");
       }
//-->
</script>

The little javascript I am putting in each of the pages is not enough to
slow Netscape down.  And, it exhibits this behavior on any site.  And, don’t
even think about resizing the screen!  :-)

Cheers!

Michael David
michael@michaeldavid.com




-----Original Message-----
From: David Kindred [mailto:davidkindred@bigfoot.com]
Sent: Monday, July 17, 2000 10:37 PM
To: ecs-list@netbloc.com
Subject: RE: [ECS] OT:Quick Java question

Hey, Michael!

I don't think JavaScript supports an Else If construction. At least, my
JavaScript book doesn't show one. The statement could be constructed as
follows:

If (item to be tested for true or false value)
   {
   // Code to be run
   }
else
   {
   if (next item to be tested for true or false value)
      {
      // Code to be run
      }
   }

I haven't looked into the hover thing, myself, yet, so can't offer any
advice there. As far as the slow rendering is concerned, do you have the
browser "if" statements sprinkled all the way through your code? If so, that
might account for the slowness if it has to query the browser all the time.
Perhaps it would be better if, at the top of the page, you determined what
type of browser you were using, and then just maintain two seperate versions
of the page to be written out below. That way, only one "if" statement is
executed. Of course, maintainenance then becomes a pain. Nothing's ever
easy, is it?

--Davey-san


-----Original Message-----
From: Michael David [mailto:michael@michaeldavid.com]
Sent: Monday, July 17, 2000 1:02 PM
To: Ecs-List@Netbloc.Com
Subject: [ECS] OT:Quick Java question
Hi folks!

Sorry I have been so scarce lately – the startup business is keeping me more
than busy for a while now.  The good news is our first site is launching
this week.  No, it’s not the automation site – that’s a few sites away
still.

Anyway, I hope you guys will pardon an off-topic question.  I figure with
all you guys playing with Mark’s new web stuff, (which I hope to have time
for someday….) that one of you might have some suggestions for me.

I’m not a Java programmer, and no nothing about it – but I try to fake it.
:-)  Anyway, I have needed to use a fair amount of on our first site.  Now I
need to change the “bookmark message” at the bottom of the screen, and I’m
not sure how to do it.

Here’s what I was thinking:

<!--
if ((navigator.appVersion.indexOf("MSIE") > 0)
  && (parseInt(navigator.appVersion) >= 4))
{
document.write("<U><SPAN
STYLE='color:black;cursor:hand;'onclick='window.external.AddFavorite(locatio
n.href,document.title);'>Click to add this page to your
Favorites!</SPAN></U>");
}
else if ((navigator.appVersion.indexOf('Netscape') != -1)
  || ((navigator.appVersion.indexOf("MSIE") > 0)
   && (parseInt(navigator.appVersion) < 4)))
{
document.write("<B>Hit Control-D to Bookmark this page!<B>");
}
else
{
    document.write("<B>Bookmark this page now!<B>");
}
//-->

Of course, it doesn’t work right from the “else if” on.  Is that the way to
do an “else if” in Java?

Also, I’d like to do a color-change-on mouse-hover in the first section of
the code, but can’t figure out how to do it.  I use hover effects on all the
links on the site (for those with MSIE), and I’d like this link to do the
same thing.

Any advice you guys can offer would be appreciated.

BTW, is it me, or is the Netscape browser (4.73) rather buggy?  Trying to
code html for both browsers has been a real pain.  Much of the java I have
used senses which browser is being used, and slightly alters the page
accordingly.  And, it sure renders slow.   Is there something I’m missing
here?

Cheers!

Michael David
michael@michaeldavid.com






Hi David!

 

I decided to abandon the three-way browser detection approach, and go with the “If MSIE browser greater that v.4 do this, if not do that” approach.  I also figured out a way to do it such my styles still apply, so this link color changes on hover like the rest of the links:

 

<script>

<!--

if ((navigator.appVersion.indexOf("MSIE") > 0)

  && (parseInt(navigator.appVersion) >= 4))

       {

        document.write("<A href='javascript:window.external.AddFavorite(location.href, document.title)'>Add this page to your favorites</A>");

       }

else

       {

        document.write("<B>Hit Control-D to Bookmark this page!<B>");

       }

//-->

</script>

 

The little javascript I am putting in each of the pages is not enough to slow Netscape down.  And, it exhibits this behavior on any site.  And, don’t even think about resizing the screen!  J

 

Cheers!

 

Michael David

michael@michaeldavid.com

 

 

 

 

-----Original Message-----
From: David Kindred [mailto:davidkindred@bigfoot.com]
Sent: Monday, July 17, 2000 10:37 PM
To: ecs-list@netbloc.com
Subject: RE: [ECS] OT:Quick Java question

 

Hey, Michael!

 

I don't think JavaScript supports an Else If construction. At least, my JavaScript book doesn't show one. The statement could be constructed as follows:

 

If (item to be tested for true or false value)

   {

   // Code to be run

   }

else

   {

   if (next item to be tested for true or false value)

      {

      // Code to be run

      }

   }

 

I haven't looked into the hover thing, myself, yet, so can't offer any advice there. As far as the slow rendering is concerned, do you have the browser "if" statements sprinkled all the way through your code? If so, that might account for the slowness if it has to query the browser all the time. Perhaps it would be better if, at the top of the page, you determined what type of browser you were using, and then just maintain two seperate versions of the page to be written out below. That way, only one "if" statement is executed. Of course, maintainenance then becomes a pain. Nothing's ever easy, is it?

 

--Davey-san

 

 

-----Original Message-----
From: Michael David [mailto:michael@michaeldavid.com]
Sent: Monday, July 17, 2000 1:02 PM
To: Ecs-List@Netbloc.Com
Subject: [ECS] OT:Quick Java question

Hi folks!

 

Sorry I have been so scarce lately – the startup business is keeping me more than busy for a while now.  The good news is our first site is launching this week.  No, it’s not the automation site – that’s a few sites away still.

 

Anyway, I hope you guys will pardon an off-topic question.  I figure with all you guys playing with Mark’s new web stuff, (which I hope to have time for someday….) that one of you might have some suggestions for me.

 

I’m not a Java programmer, and no nothing about it – but I try to fake it. J  Anyway, I have needed to use a fair amount of on our first site.  Now I need to change the “bookmark message” at the bottom of the screen, and I’m not sure how to do it.

 

Here’s what I was thinking:

 

<!--

if ((navigator.appVersion.indexOf("MSIE") > 0)

  && (parseInt(navigator.appVersion) >= 4))

{

document.write("<U><SPAN STYLE='color:black;cursor:hand;'onclick='window.external.AddFavorite(location.href,document.title);'>Click to add this page to your Favorites!</SPAN></U>");

}

else if ((navigator.appVersion.indexOf('Netscape') != -1)

  || ((navigator.appVersion.indexOf("MSIE") > 0)

   && (parseInt(navigator.appVersion) < 4)))

{

document.write("<B>Hit Control-D to Bookmark this page!<B>");

}

else

{

    document.write("<B>Bookmark this page now!<B>");

}

//-->

 

Of course, it doesn’t work right from the “else if” on.  Is that the way to do an “else if” in Java?

 

Also, I’d like to do a color-change-on mouse-hover in the first section of the code, but can’t figure out how to do it.  I use hover effects on all the links on the site (for those with MSIE), and I’d like this link to do the same thing.

 

Any advice you guys can offer would be appreciated.

 

BTW, is it me, or is the Netscape browser (4.73) rather buggy?  Trying to code html for both browsers has been a real pain.  Much of the java I have used senses which browser is being used, and slightly alters the page accordingly.  And, it sure renders slow.   Is there something I’m missing here?

 

Cheers!

 

Michael David

michael@michaeldavid.com

 

 

 

 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects




Services provided by [NetBloc]®! NetBloc Solutions Inc.
Terms of use. Indexing software (c) 1999 Lin-De, Inc
.