Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: does netscape support javascript


Message #1 by "Shraddha Kagalwala" <skagalwa@n...> on Wed, 3 Jul 2002 10:12:59 -0400
hi
here i am attaching the files for your kind reference
 code is
like this
<head>
<title>helpdesk</title><link href="CascadeMenu.css" rel="stylesheet">
<script language="javascript" src="CascadeMenu.js"></script>
</head>
<body onLoad="InitMenu()" onClick="HideMenu(menuBar)" id="Bdy"
bgcolor="#ffffff" leftmargin="0" topmargin="0" marginheight="0"
marginwidth="0">
<server>
<script language="javascript">
if(!database.connected())
{
database.connect("ODBC","helpdesk","","","","","")
}
if(database.connected())
{
write("successfully connected")
}
</script>
</server>
	<div id="menuBar" class="menuBar">
		<div id="Bar1" class="Bar" menu="menu1">NEWS</div>
		<div id="Bar2" class="Bar" menu="menu2">LINKS</div>
	</div>	<!--MenuItem Definition -->
	<div id="menu1" class="menu">
		<div id="menuItem1_1" class="menuItem">topic1</div>
		<div id="menuItem1_2" class="menuItem">topic2</div>
		<div id="menuItem1_3" class="menuItem">topic3</div>
	</div>
	<div id="menu2" class="menu">
		<div id="menuItem2_1" class="menuItem">topic1</div>
		<div id="menuItem2_2" class="menuItem">topic2</div>
		<div id="menuItem2_3" class="menuItem">topic3</div>
	</div>	<!-- End of Menu -->
</body>

this is the main file

the cascade menu javascript file is


   function InitMenu()
   {
     var bar = menuBar.children

     for(var i=0;i < bar.length;i++)
        {
          var menu=eval(bar[i].menu)
          menu.style.visibility = "hidden"
          bar[i].onmouseover = new Function("ShowMenu("+bar[i].id+")")
          var Items = menu.children
          for(var j=0; j<Items.length; j++)
            {
              var menuItem = eval(Items[j].id)

                if(menuItem.menu != null)
                   {
                    menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow
class='Arrow'>4</Span>"
                    //var tmp = eval(menuItem.id+"_Arrow")
                    // tmp.style.pixelLeft 
menu.getBoundingClientRect().Right //- tmp.offsetWidth - 15
                    FindSubMenu(menuItem.menu)}

                 if(menuItem.cmd != null)
                   {
                   menuItem.onclick = new Function("Do("+menuItem.id+")") }

              menuItem.onmouseover = new
Function("highlight("+Items[j].id+")")

            }
               	menuItem.onmouseout =new Function("hid()")
        }
		       	menuItem.onmouseout =new Function("hid()")
   }
   function FindSubMenu(subMenu)
   {
         var menu=eval(subMenu)
         var Items = menu.children
          for(var j=0; j<Items.length; j++)
            {
             menu.style.visibility = "hidden"
              var menuItem = eval(Items[j].id)

              if(menuItem.menu!= null)
                 {
                    menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow
class='Arrow'>4</Span>"
                    // var tmp = eval(menuItem.id+"_Arrow")
                    //tmp.style.pixelLeft = 35
//menuItem.getBoundingClientRect().right - tmp.offsetWidth - 15
                    FindSubMenu(menuItem.menu)
                 }

                 if(menuItem.cmd != null)
                   {
                   menuItem.onclick = new Function("Do("+menuItem.id+")") }

              menuItem.onmouseover = new
Function("highlight("+Items[j].id+")")

            }
       	menuItem.onmouseout =new Function("hid()")
   }

function hid()
{
HideMenu(menuBar)

}

   function ShowMenu(obj)
   {
     HideMenu(menuBar)
     var menu = eval(obj.menu)
     var bar = eval(obj.id)
     bar.className="barOver"
     menu.style.visibility = "visible"
     menu.style.pixelTop =  obj.getBoundingClientRect().top +
obj.offsetHeight + Bdy.scrollTop
     menu.style.pixelLeft = obj.getBoundingClientRect().left +
Bdy.scrollLeft
   }

   function highlight(obj)
   {
     var PElement = eval(obj.parentElement.id)
     if(PElement.hasChildNodes() == true)
     {  var Elements = PElement.children
       for(var i=0;i<Elements.length;i++)
       {
          TE = eval(Elements[i].id)
          TE.className = "menuItem"
       }
      }
     obj.className="ItemMouseOver"
     window.defaultStatus = obj.title
     ShowSubMenu(obj)
   }

   function Do(obj)
   {
    var cmd = eval(obj).cmd
    window.navigate(cmd)

   }

   function HideMenu(obj)
   {
          if(obj.hasChildNodes()==true)
              {
                 var child = obj.children

                 for(var j =0;j<child.length;j++)
                  {
                     if (child[j].className=="barOver")
                     {var bar = eval(child[j].id)
                      bar.className="Bar"}

                     if(child[j].menu != null)
                       {
                          var childMenu = eval(child[j].menu)
                          if(childMenu.hasChildNodes()==true)
                               HideMenu(childMenu)

                           childMenu.style.visibility = "hidden"
                         }
                  }

              }
   }
  function ShowSubMenu(obj)
  {
     PMenu = eval(obj.parentElement.id)
      HideMenu(PMenu)
     if(obj.menu != null)
     {
     var menu = eval(obj.menu)
     menu.style.visibility = "visible"
     menu.style.pixelTop =  obj.getBoundingClientRect().top + Bdy.scrollTop
     menu.style.pixelLeft = obj.getBoundingClientRect().right +
Bdy.scrollLeft
     if(menu.getBoundingClientRect().right > window.screen.availWidth )
       menu.style.pixelLeft = obj.getBoundingClientRect().left -
menu.offsetWidth
    }
  }

thanks
shraddha

-----Original Message-----
From: Greg Griffiths [mailto:greg.griffiths@g...]
Sent: Friday, July 05, 2002 2:58 PM
To: javascript
Subject: [javascript] Re: does netscape support javascript


This is the standard syntax for Javascript, if you got an error it was
probably from something else, post your code and we'll have a look.

At 00:56 05/07/02 +0000, you wrote:
>Hi:
>
>  can we use this include syntax for IE6, I had do it once and when I open
> the html file with IE6 it display nothing. Can help!!
>Thank a lot.
>
>
>>From: True2ViSioN@a...
>>Reply-To: "javascript" <javascript@p...>
>>To: "javascript" <javascript@p...>
>>Subject: [javascript] Re: does netscape support javascript
>>Date: Wed, 3 Jul 2002 20:34:22 EDT
>>
>>yes netscape does support javascript
>>to include the .js file try this
>><SCRIPT LANGUAGE="javascript" SRC="file.js"></SCRIPT>
>>that should help you out if thats what your asking
>>
>>
>>---
>>
>>Improve your web design skills with these new books from Glasshaus.
>>
>>Usable Web Menus
>>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>>r-20
>>Constructing Accessible Web Sites
>>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>>r-20
>>Practical JavaScript for the Usable Web
>>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>>r-20
>
>
>
>
>_________________________________________________________________
>Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>
>---
>
>Improve your web design skills with these new books from Glasshaus.
>
>Usable Web Menus
>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>r-20
>Constructing Accessible Web Sites
>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>r-20
>Practical JavaScript for the Usable Web
>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>r-20
>---
>Change your mail options at http://p2p.wrox.com/manager.asp or to
>unsubscribe send a blank email to 




---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20


  Return to Index