www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 04-20-2005, 06:34 PM
    maxdezign maxdezign is offline
    Registered User
     
    Join Date: Apr 2005
    Posts: 3
    document about firefox javascript

    i need to use javascript for firefox.
    if u have something about this.
    plez send to me.

    maxdezign@gmail.com

    sorry my language so bad.
    Reply With Quote
      #2  
    Old 04-20-2005, 10:45 PM
    phpnovice phpnovice is offline
    Banned
     
    Join Date: Dec 2004
    Posts: 8,652
    Basically, JavaScript is JavaScript without consideration for the browser. The only exception to this is in IE -- but, even then, what works in the other browsers will also work in IE 99% of the time. So, is it just plain JavaScript you really want to know about?
    Reply With Quote
      #3  
    Old 04-21-2005, 12:46 PM
    maxdezign maxdezign is offline
    Registered User
     
    Join Date: Apr 2005
    Posts: 3
    i want to use layer in firefox
    i want to know function for write layer hide layer show layer and set x,y in layer

    now i can use this in ie bu this code error in firefox and ns

    sorry my eng so bad
    Reply With Quote
      #4  
    Old 04-21-2005, 05:06 PM
    phpnovice phpnovice is offline
    Banned
     
    Join Date: Dec 2004
    Posts: 8,652
    HTML Code:
    <div id="myLayer>
    This is a layer.
    </div>
    To hide it:
    Code:
    document.getElementById("myLayer").style.display = "none";
    To show it:
    Code:
    document.getElementById("myLayer").style.display = "block";
    To change the layer's text:
    Code:
    document.getElementById("myLayer").firstChild.data = "This is MY layer.";
    Reply With Quote
      #5  
    Old 04-28-2005, 06:01 PM
    maxdezign maxdezign is offline
    Registered User
     
    Join Date: Apr 2005
    Posts: 3
    thank
    Reply With Quote
      #6  
    Old 04-29-2005, 04:01 PM
    phpnovice phpnovice is offline
    Banned
     
    Join Date: Dec 2004
    Posts: 8,652
    Thumbs up You're welcome.

    Cheers.
    Reply With Quote
      #7  
    Old 05-16-2005, 06:55 PM
    pizzaluva pizzaluva is offline
    Registered User
     
    Join Date: May 2005
    Posts: 5
    I'm still having some problems with this..
    could you check out my page at :

    http://www.welovewinter.com/showhidelayer.html

    I'm not exactly a developer, so i'm pretty clueless with some things..
    ANy help would be greatly appreciated!

    works fine in IE, but not at all in firefox.


    Code:
    <script language="JavaScript">
    <!--
    var NN4 = document.layers? true : false;
    var IE4 = document.all? true : false;
    var FF = document.getElementById? true : false;
    var left;
    var top;
    
    function display(layerName) {
      if (IE4) {
        document.all[layerName].style.visibility = "visible";
      }
      else if(NN4) {
        document.layers[layerName].visibility = "show";
      }
      else if(FF) {
        document.getElementById('layer1').style.display = "block";
      }
    }
    
    function hide() {
      if (IE4) {
        document.all['layer1'].style.visibility = "hidden";
      }
      else if(NN4) {
        document.layers['layer1'].visibility = "hidden";
       }
      else if(FF) {
        document.getElementById("layer1").style.display = "none";
      }
    }
    
    
    // -->
    </script>

    Last edited by pizzaluva; 05-16-2005 at 07:17 PM.
    Reply With Quote
      #8  
    Old 05-16-2005, 08:32 PM
    phpnovice phpnovice is offline
    Banned
     
    Join Date: Dec 2004
    Posts: 8,652
    I'd suggest rearranging this:
    Code:
    function display(layerName) {
      if (IE4) {
        document.all[layerName].style.visibility = "visible";
      }
      else if(NN4) {
        document.layers[layerName].visibility = "show";
      }
      else if(FF) {
        document.getElementById('layer1').style.display = "block";
      }
    }
    into this:
    Code:
    function display(id) {
      if (document.getElementById) {
        document.getElementById(id).style.display = "block";
      }
      else if (document.layers) {
        document.layers[id].visibility = "show";
      }
      else if (document.all) {
        document.all[id].style.visibility = "visible";
      }
      else {
        alert('Unknown browser category.');
      }
    }
    and likewise:
    Code:
    function hide(id) {
      if (document.getElementById) {
        document.getElementById(id).style.display = "none";
      }
      else if (document.layers) {
        document.layers[id].visibility = "hide";
      }
      else if (document.all) {
        document.all[id].style.visibility = "hidden";
      }
      else {
        alert('Unknown browser category.');
      }
    }
    Reply With Quote
      #9  
    Old 05-17-2005, 02:42 AM
    pizzaluva pizzaluva is offline
    Registered User
     
    Join Date: May 2005
    Posts: 5
    that didn't seem to work.. actually now it won't work in IE.


    heres what i have:

    Code:
    <script language="JavaScript">
    <!--
    
    var left;
    var top;
    
    function display(id) {
      if (document.getElementById) {
        document.getElementById(id).style.display = "block";
      }
      else if (document.layers) {
        document.layers[id].visibility = "show";
      }
      else if (document.all) {
        document.all[id].style.visibility = "visible";
      }
      else {
        alert('Unknown browser category.');
      }
    }
    
    function hide(id) {
      if (document.getElementById) {
        document.getElementById(id).style.display = "none";
      }
      else if (document.layers) {
        document.layers[id].visibility = "hide";
      }
      else if (document.all) {
        document.all[id].style.visibility = "hidden";
      }
      else {
        alert('Unknown browser category.');
      }
    }
    
    
    // -->
    </script>
    
    
    
    <head>
    <body>
    
    <table width="500" border="1">
    <tr>
    <td align="center" class="tiny" bgcolor="#ff0000"
    	 style="cursor: pointer" onclick=' display("layer1")'
    	  onMouseOver="this.style.backgroundColor='000040'; 
    	 return
    	 true;" onMouseOut="this.style.backgroundColor='#ff0000';"><font color="white">SHOW WINDOW</font></td>
    </tr>
    </table>
    
    
    
    
    <div id="layer1" style="left:305px; position:absolute; top:205px; visibility:hidden; z-index:0">
    <table width="500" bgcolor="blue" height="300" border="2">
    <tr>
    <td height="30" align="center" class="tiny" bgcolor="#ff0000"
    	 style="cursor: pointer" onclick=' hide("layer1")'
    	  onMouseOver="this.style.backgroundColor='000040'; 
    	 return
    	 true;" onMouseOut="this.style.backgroundColor='#ff0000';"><font color="white">CLOSE WINDOW</font></td>
    </tr>
    
    <tr><td>LAYER 1 TABLE</td></tr>
    </table>
    </div>
    Reply With Quote
      #10  
    Old 05-17-2005, 08:28 AM
    phpnovice phpnovice is offline
    Banned
     
    Join Date: Dec 2004
    Posts: 8,652
    Change the quotes on these:

    onclick=' display("layer1")'

    to be like this:

    onclick="display('layer1')"

    Although, technically, you should add return true; to the end of each function and code the events as follows:

    onclick="return display('layer1')"
    Reply With Quote
      #11  
    Old 05-17-2005, 08:37 AM
    phpnovice phpnovice is offline
    Banned
     
    Join Date: Dec 2004
    Posts: 8,652
    I reworked your source a bit so that it will work now:
    HTML Code:
    <script language="javascript" type="text/javascript">
    <!--//
    function display(id) {
      if (document.getElementById) {
        document.getElementById(id).style.display = "block";
      }
      else if (document.layers) {
        document.layers[id].visibility = "show";
      }
      else if (document.all) {
        document.all[id].style.visibility = "visible";
      }
      else {
        alert('Unknown browser category.');
      }
      return true;
    }
    
    function hide(id) {
      if (document.getElementById) {
        document.getElementById(id).style.display = "none";
      }
      else if (document.layers) {
        document.layers[id].visibility = "hide";
      }
      else if (document.all) {
        document.all[id].style.visibility = "hidden";
      }
      else {
        alert('Unknown browser category.');
      }
      return true;
    }
    //-->
    </script>
    <head>
    
    <body>
    
    <table width="500" border="1">
      <tr>
        <td align="center" class="tiny" bgcolor="#ff0000"
         style="cursor: pointer" onclick="return display('layer1')"
         onMouseOver="this.style.backgroundColor='#000040'; return true;"
         onMouseOut="this.style.backgroundColor='#ff0000'; return true;">
        <font color="white">SHOW WINDOW</font></td>
      </tr>
    </table>
    
    <div id="layer1" style="position:absolute; left:305px; top:205px; z-index:0;">
      <table width="500" bgcolor="blue" height="300" border="2">
        <tr>
          <td height="30" align="center" class="tiny" bgcolor="#ff0000"
           style="cursor: pointer" onclick="return hide('layer1')"
           onMouseOver="this.style.backgroundColor='#000040'; return true;"
           onMouseOut="this.style.backgroundColor='#ff0000'; return true;">
          <font color="white">CLOSE WINDOW</font></td>
        </tr>
        <tr><td>LAYER 1 TABLE</td></tr>
      </table>
    </div>
    
    <script language="javascript" type="text/javascript">
    <!--//
    var x = hide('layer1');
    //-->
    </script>
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 07:56 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.