Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape 4: Changing text within a layer

    I am having a Netscape Text layer changing problem

    I have a hidden layer with text. When an image is clicked somewhere else on the page, I want the text within the layer to change and than make the layer unhidden.

    I am successful with IE, but cannot find a solution for Netscape 4. Any help would be great.

    Here’s the code I have so far:

    Javascript:
    function showMessage(messageId,id_hide) {
    if (document.layers){ // nn4
    document.layers[messageId].visibility='show';
    }else if (document.all){ // ie
    document.all(messageId).style.visibility='visible';
    }else if (document.getElementById){ // nn6
    document.getElementById(messageId).style.visibility='visible';
    }
    }

    function showHiddenDiv(messageId) {
    if (document.layers){ // nn4
    document.layers[messageId].document.open();
    document.layers[messageId].document.write("print something");
    document.layers[messageId].document.close();
    }else if (document.all){ // ie
    document.all(messageId).innerText = "Hello";
    }else if (document.getElementById){ // nn6
    document.getElementById(messageId).style.visibility='hidden';
    }
    if (document.layers){ // nn4
    if (document.layers[messageId].visibility == "show") {
    hideMessage(messageId);
    }
    else {
    showMessage(messageId);
    }
    }else if (document.all){ // ie
    if (document.all(messageId).style.visibility == "visible") {
    hideMessage(messageId);
    }
    else {
    showMessage(messageId);
    }
    }else if (document.getElementById){ // nn6
    document.getElementById(messageId).style.visibility='visible';
    }
    }


    HTML (in a table cell):
    <div style="position: relative; visibility: hidden" id="divtest" nohref>Rapid Registry</div>

    Link Event:
    <a href="javascript:showHiddenDiv('divtest');">divtest layer</a><br>

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    You said the magic word: table. Uh-oh.


    <HTML>
    <HEAD>
    <TITLE>untitled</TITLE>
    <script type="text/javascript">

    function showMessage(messageId,id_hide) {
    if (document.layers){ // nn4
    document['NS_' + messageId].document.layers[0].visibility='show';
    }else if (document.all){ // ie
    document.all(messageId).style.visibility='visible';
    }else if (document.getElementById){ // nn6
    document.getElementById(messageId).style.visibility='visible';
    }
    }

    function showHiddenDiv(messageId) {
    if (document.layers){ // nn4
    var l = document['NS_' + messageId].document.layers[0];
    l.document.write('<span style="font:200 16px arial;">print something</span>');
    l.document.close();
    }else if (document.all){ // ie
    document.all(messageId).innerHTML = "Hello";
    document.all(messageId).style.font='bold 24px helvetica';
    }else if (document.getElementById){ // nn6
    document.getElementById(messageId).style.visibility='hidden';
    }
    if (document.layers){ // nn4
    if (l.visibility == "show") {
    hideMessage(messageId);
    }
    else {
    showMessage(messageId);
    }
    }else if (document.all){ // ie
    if (document.all(messageId).style.visibility == "visible") {
    hideMessage(messageId);
    }
    else {
    showMessage(messageId);
    }
    }else if (document.getElementById){ // nn6
    document.getElementById(messageId).style.visibility='visible';
    }
    }
    </script>
    </HEAD>
    <BODY>
    <table bgcolor="skyblue"><tr>
    <td id="divtest" width="100"><ilayer id="NS_divtest"><layer width="100">Rapid Registry
    </layer></ilayer></td></tr></table>

    <a href="javascript&#58;void showHiddenDiv('divtest')">divtest layer</a><br>
    </BODY>
    </HTML>


    The <td><ilayer><layer></layer></ilayer></td> nonsense is about the only thing that holds 'em in there. The id for the <ilayer> can't be the same as the <td> since IE parses everything. The void in the link keeps it from loading. hth


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •