SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Swap text onRollover text?





    Hi there,

    I think i need to post this here, i need the following for my site:

    1 Each product is represented bij a square.gif (with a roll-over "squareon.gif)
    2 Onrollover/onmouseover a corresponding text is shown, each time on the same place on the stage. For these i am using a layer/div and display: none;

    So far i have things working dynamicly with PHP, that is each product is shown as a square and the corresponding texten sits there.

    Now what i want to do is, to show the corresponding text when a user (onmouseover) square.gif. How do i do this?

    code parsed by php
    PHP Code:
    <td class="leftAlign"><div id="div1" style="position:absolute; left:10px; top:10px; width:170px; height:20px; z-index:1; visibility: hidden;">Flyer 1</div>
    <
    a href="#" onMouseOver="SwapImg ('dtl1','over') , SwapTxt ('div1','over')" 
         
    onMouseOut="SwapImg ('dtl1','out'), SwapTxt ('div1','out')">
    <
    img src="images/sq_false.gif" width="7" height="7" border="0" name="dtl1" />
    </
    a>
         <
    div id="div2" style="position:absolute; left:10px; top:10px; width:170px; height:20px; z-index:2; visibility: hidden;">Flyer 2</div>
    <
    a href="#" onMouseOver="SwapImg ('dtl2','over') , SwapTxt ('div2','over')" 
         
    onMouseOut="SwapImg ('dtl2','out'), SwapTxt ('div2','out')">
    <
    img src="images/sq_false.gif" width="7" height="7" border="0" name="dtl2" />
    </
    a>
         <
    div id="div3" style="position:absolute; left:10px; top:10px; width:170px; height:20px; z-index:3; visibility: hidden;">Poster</div>
    <
    a href="#" onMouseOver="SwapImg ('dtl3','over') , SwapTxt ('div3','over')" 
         
    onMouseOut="SwapImg ('dtl3','out'), SwapTxt ('div3','out')">
    <
    img src="images/sq_false.gif" width="7" height="7" border="0" name="dtl3" />
    </
    a>
         </
    td


    Does these make sense:
    PHP Code:
    function SwapTxt(divIDaction) {
    switch (
    action)
    {
    case 
    "over":
    document.getElementById("divID").style.display "block"
    break;
    case 
    "out":
    document.getElementById("divID").style.display "none";
    break;
    }


    ps not mine just combining some things i have found on the subject

    Any tips?

  2. #2
    Fine Tuned silver trophy KC's Avatar
    Join Date
    Sep 2001
    Posts
    2,291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to the appropriate forum.
    Former Design Your Site Team Leader

  3. #3
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function SwapTxt(divID, action) {
    switch (action)
    {
    case "over":
    document.getElementById("divID").style.display = "block";
    break;
    case "out":
    document.getElementById("divID").style.display = "none";
    break;
    }
    }
    Remove the 'quotes' from around divID. divID is a variable, not a string literal.


Bookmarks

Posting Permissions

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