SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Layer on and off in PHP

    I know this can be done through Dreamweaver but is it possible to have a layer or div show and hide depending on the mouse action? Are there any similar scripts or tutorials about this kind of thing?

    What I need to happen:

    When a user clicks an image, in the right-hand column some info appears. When the user clicks another image, the previous info hides and the new info appears.

    Could this be done through a simple query using an image map to generate the WHERE variable?

  2. #2
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We can do this easily by div. See below example script.
    function togglediv(mode)
    {
    if(mode=='show')
    {
    document.getElementById('divname').style.display = block;
    //this will appear div
    }
    elseif(mode=='hide')
    {
    document.getElementById('divname').style.display = none;
    //this will disappear div
    }
    }
    <img src="abc.jpg" onclick="togglediv('show')"><BR>
    <img src="abc.jpg" onclick="togglediv('hide')">
    <div style='display:none' id='divname'></div>

    Just change it as you need.

  3. #3
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you. I must say that this forum is brilliant for php learners such as myself. Thanks again. Have some Kudos

  4. #4
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is this a javascript function? Not sure on how to incorporate this into my php page.


Tags for this Thread

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
  •