Looking for bit mod. of my existing php code (display hidden elements)

Discussion in 'PHP' started by Shakil, Oct 11, 2010.

  1. #1
    Hi

    I m using a php code to hide text/elements.

    Here it is
     onclick=\"document.all.a.style.display= document.all.a.style.display=='none' ? '' : 'none'\" 
    PHP:
     id=\"a\" style=\"display: none;\" 
    PHP:
    What happened with this code: It hide the elements and when i click once it visible the element and when i click again it hide the elements.

    -------------------------------------------------------
    I m looking something more....

    I use the code 3 or more in a page by changing id . So when i click id a Id a is visible when i click Id b, Id b is visible and i have to click again id a or b to hide the ID a and b

    I need to use bit modification like, (I have ID a, b, c, d, e)
    when i click id a, ID a will visible and if i click ID a again ID a will hide or If i click ID b/c/d/e whatever ID is , ID a will hide first (If ID a is not hide yet) and then and ID b will visible.

    same way for all ID use....

    Could anyone make this way.... short code/syntax ?

    If possible could anyone make slow hide/visibility toggle elements with my existing code above display(i m using) with short code/syntax ?

    Plz i avoid jquery...


    Thanks for Advance
     
    Last edited: Oct 11, 2010
    Shakil, Oct 11, 2010 IP
  2. learnerabn

    learnerabn Peon

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First of all the code here not even a bit relavant to php. those are all doing some thing with javascript, html and css.
    first you add a class to all the elements a,b,c,d,e and onclick event you call a function in that funtion you have to hide those class and show the id.
    if you want you can add the toggle() method.For that refer the link here and here
     
    learnerabn, Oct 11, 2010 IP
  3. Shakil

    Shakil Greenhorn

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    thanks for intention to help
    Oh i m sorry!

    i avoid jquery ...

    i like to use through javascript/css/php code
     
    Shakil, Oct 12, 2010 IP
  4. learnerabn

    learnerabn Peon

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sorry i think i cant understand you...

    here where comes php i dont know...
    and why you are avoiding jquery?
     
    learnerabn, Oct 12, 2010 IP
  5. Shakil

    Shakil Greenhorn

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    no one else can make it through javascript or php or others except jquery .. ? :(
     
    Shakil, Oct 16, 2010 IP
  6. learnerabn

    learnerabn Peon

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    learnerabn, Oct 17, 2010 IP
  7. Shakil

    Shakil Greenhorn

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    Brother i have very little knowledge of script so i cant modify it...

    plz see this : http://dhtml-menu.com/tree-examples/tree-menuxp3.html

    I need only like this when i click 1 tree automatically other tree/toggle will hide...

    thats it, plz give a code with this
    onclick=\"document.all.a.style.display= document.all.a.style.display=='none' ? '' : 'none'\"
    PHP:
    id=\"a\" style=\"display: none;\"
    PHP:
     
    Shakil, Oct 17, 2010 IP