Results 1 to 3 of 3

Thread: <div><layers> and dynamic text w/ mouseOver...

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    hello,
    I have an <a href> on the left side of my screen.
    on the right side I have some text. I want to have javascript that works in both browser and when I roll over the <a href> the text on the right side of the screen will change.


    I have tried using the <div ID="newText">
    and <layer ID="newText">but I can only get it to work in one browser or the other not both.
    I haven't include my code becouse I think it is so messed up it will just mess you up worse than not seeing it at all.


    if this makes no sense let me know and I will rewrite it so it is easyier to understand.

    basicly I want to do what you could do w/ an image swap only I want to use text.

    thanks

    pnj

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    this works with IE and Netscape 4

    Code:
    <HTML>
    <HEAD>
    <script language=javascript>
    var ntext;
    var otext;
    function init()
    {
    	if (document.all) {ntext = object1.style}
    	if (document.all) {otext = object2.style}
    	if (document.layers) {ntext = document.object1}
    	if (document.layers) {otext = document.object2}
    }	
    
    
    function oldText()
    {
    	otext.visibility = 'hidden';
    	ntext.visibility = 'visible';
    }	
    
    function newText()
    {
    	
    	ntext.visibility = 'hidden';
    	otext.visibility = 'visible';
    }	
    
    
    </script>
    </HEAD>
    <BODY onLoad="init()">
    <a href="" onMouseover="newText()" onMouseout="oldText()">click here</A>
    
    <div ID="object1" STYLE="position:absolute;top:10;left:270">
    Old Text
    </div>
    <div ID="object2" STYLE="position:absolute;top:10;left:270;visibility:hidden">
    new text
    
    </div>
    
    
    </BODY>
    </HTML>
    Mark
    -------------------

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537

    thank!

    thanks a bunch,
    that is super cool.
    pnj

Posting Permissions

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



Click Here to Expand Forum to Full Width