HTML Query

Discussion in 'HTML' started by Ramon, Jan 3, 2009.

  1. Ramon

    Ramon Guest

    Hi,

    Does someone here knows if there exists a tag that can fold/hide text...
    and when the user clicks it, the text will become visible.

    Thanks
    Ramon, Jan 3, 2009
    #1
    1. Advertising

  2. Ramon

    Neredbojias Guest

    On 03 Jan 2009, Ramon <> wrote:

    > Hi,
    >
    > Does someone here knows if there exists a tag that can fold/hide
    > text... and when the user clicks it, the text will become visible.
    >
    > Thanks


    How would the user be able to click it when it's invisible?

    --
    Neredbojias
    http://www.neredbojias.org/
    http://www.neredbojias.net/
    The road to Heaven is paved with bad intentions.
    Neredbojias, Jan 3, 2009
    #2
    1. Advertising

  3. Ramon

    Els Guest

    Neredbojias wrote:
    > On 03 Jan 2009, Ramon <> wrote:
    >
    >> Does someone here knows if there exists a tag that can fold/hide
    >> text... and when the user clicks it, the text will become visible.

    >
    > How would the user be able to click it when it's invisible?


    nitpick! ;-)

    --
    Els http://locusmeus.com/
    Els, Jan 3, 2009
    #3
  4. Ramon

    Ramon Guest

    Neredbojias wrote:
    > On 03 Jan 2009, Ramon <> wrote:
    >
    >> Hi,
    >>
    >> Does someone here knows if there exists a tag that can fold/hide
    >> text... and when the user clicks it, the text will become visible.
    >>
    >> Thanks

    >
    > How would the user be able to click it when it's invisible?
    >

    What I meant is that you have something like this:
    [+] Click here to see more information.

    When the user clicks on the [+], he/she will see something like this:
    [+] Click here to see more information.
    Some text here that the user could not see
    before -- thus invisible :)
    Other text here ...

    Is is possible in HTML?
    Ramon, Jan 3, 2009
    #4
  5. Ramon wrote:

    >>> Does someone here knows if there exists a tag that can fold/hide
    >>> text... and when the user clicks it, the text will become visible.
    >>>
    >>> Thanks

    >>
    >> How would the user be able to click it when it's invisible?


    The answer to that question is obviously "by accident", though some people
    may include the possibility of "by miracle".

    > What I meant is that you have something like this:
    > [+] Click here to see more information.
    >
    > When the user clicks on the [+], he/she will see something like this:
    > [+] Click here to see more information.
    > Some text here that the user could not see
    > before -- thus invisible :)
    > Other text here ...


    It's generally useful to ask what you really want, instead of something
    quite different. It is also a good idea to write a Subject line that gives
    at least a subtle hint of a clue of an allusion to what the content is
    about.

    It's generally useful to present your content to users without hiding it in
    elaborate ways that generally exhibit poor accessibility, poor usability,
    and poor style. "Click here" is virtually always bad style.

    > Is is possible in HTML?


    No. You need to study an introduction to the basics of HTML if you had the
    idea that it could be. HTML is poor lonesome data format, not a programming
    language or even a style language.

    Well of course it _is_ possible in the sense that "[+]" could be a link
    pointing to a page that differs from the current one only so that there is
    the additional content there (and the content after it is pushed downwards
    of course). But that's hardly what you meant.

    What people normally use to do things like you describe is a combination of
    JavaScript and CSS; naturally there needs to be some marked-up data (i.e.,
    HTML stuff) for them to play with. And sometimes people use just CSS
    (playing on HTML of course), though then the user just mouses over instead
    of clicking. It can be fun, to an author, but it's normally not useful.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Jan 3, 2009
    #5
  6. Ramon

    Ramon Guest

    Jukka K. Korpela wrote:
    > Ramon wrote:
    >
    >>>> Does someone here knows if there exists a tag that can fold/hide
    >>>> text... and when the user clicks it, the text will become visible.
    >>>>
    >>>> Thanks
    >>>
    >>> How would the user be able to click it when it's invisible?

    >
    > The answer to that question is obviously "by accident", though some
    > people may include the possibility of "by miracle".
    >
    >> What I meant is that you have something like this:
    >> [+] Click here to see more information.
    >>
    >> When the user clicks on the [+], he/she will see something like this:
    >> [+] Click here to see more information.
    >> Some text here that the user could not see
    >> before -- thus invisible :)
    >> Other text here ...

    >
    > It's generally useful to ask what you really want, instead of something
    > quite different. It is also a good idea to write a Subject line that
    > gives at least a subtle hint of a clue of an allusion to what the
    > content is about.
    >
    > It's generally useful to present your content to users without hiding it
    > in elaborate ways that generally exhibit poor accessibility, poor
    > usability, and poor style. "Click here" is virtually always bad style.
    >
    >> Is is possible in HTML?

    >
    > No. You need to study an introduction to the basics of HTML if you had
    > the idea that it could be. HTML is poor lonesome data format, not a
    > programming language or even a style language.
    >
    > Well of course it _is_ possible in the sense that "[+]" could be a link
    > pointing to a page that differs from the current one only so that there
    > is the additional content there (and the content after it is pushed
    > downwards of course). But that's hardly what you meant.
    >
    > What people normally use to do things like you describe is a combination
    > of JavaScript and CSS; naturally there needs to be some marked-up data
    > (i.e., HTML stuff) for them to play with. And sometimes people use just
    > CSS (playing on HTML of course), though then the user just mouses over
    > instead of clicking. It can be fun, to an author, but it's normally not
    > useful.
    >


    Thanks.
    Ramon, Jan 3, 2009
    #6
  7. Ramon

    Bergamot Guest

    Ed Mullen wrote:
    > Ramon wrote:
    >>
    >> Does someone here knows if there exists a tag that can fold/hide
    >> text... and when the user clicks it, the text will become visible.

    >
    > http://markehansen.07x.net/FAQ.htm


    if(document.layers)...

    icky-poo!

    --
    Berg
    Bergamot, Jan 3, 2009
    #7
  8. Bergamot wrote:
    >
    > Ed Mullen wrote:
    >> Ramon wrote:
    >>>
    >>> Does someone here knows if there exists a tag that can fold/hide
    >>> text... and when the user clicks it, the text will become visible.

    >>
    >> http://markehansen.07x.net/FAQ.htm

    >
    > if(document.layers)...
    >
    > icky-poo!
    >

    Not sue how many Netscape 4.x users are still out their, but at least
    they are using *object* detection of stupid user agent sniffing...I am
    getting awful tired if PayPal's warning dialogs in their tools that my
    browser is not supported "IE 5.5+ FF 1.0+ Safari 1.2+" while using
    SeaMonkey 1.1.14

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jan 3, 2009
    #8
  9. Re: HTML Query - addendum

    Jonathan N. Little wrote:
    > Bergamot wrote:
    >>


    >> if(document.layers)...
    >>
    >> icky-poo!
    >>

    > Not sue how many Netscape 4.x users are still out their, but at least


    *sure*

    > they are using *object* detection of stupid user agent sniffing...


    The site's real error is that they have the text hidden by default in
    the styling. It should be displayed and the via JavaScript upon loading
    set to hide so that if the user has JavaScript disabled the content is
    visible.

    The Rule is JavaScript is option and the page should be usable without it.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jan 3, 2009
    #9
  10. Ramon

    Ramon Guest

    Thanks Ed for your tips. It worked great!

    Ed Mullen wrote:
    > Ramon wrote:
    >> Hi,
    >>
    >> Does someone here knows if there exists a tag that can fold/hide
    >> text... and when the user clicks it, the text will become visible.
    >>
    >> Thanks

    >
    > You need javascript but there are lots of existing examples:
    >
    > http://markehansen.07x.net/FAQ.htm
    >
    > http://www.tjkdesign.com/articles/toggle_elements.asp
    >
    > Google text toggle for more.
    >
    >
    Ramon, Jan 3, 2009
    #10
  11. Ramon

    Tim Greer Guest

    Ramon wrote:

    > Hi,
    >
    > Does someone here knows if there exists a tag that can fold/hide
    > text... and when the user clicks it, the text will become visible.
    >
    > Thanks


    CSS is good for this sort of thing, as is JavaScript, or something like
    Flash, depending on the technology you want to use. CSS might be the
    most compatible with the most browsers.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
    Tim Greer, Jan 3, 2009
    #11
  12. Ramon

    dorayme Guest

    In article <>,
    Bergamot <> wrote:

    > icky-poo!


    This expression is a little too babyish for grown ups around here."Yuk"
    might just get over the line for adults. "Bloody hell!" (and stronger as
    far as I am concerned) and "Geez" are also perfectly acceptable to most
    people. Some others, perhaps more Australian in nature, would be ok too:
    "Don't make me puke, mate" and "Piss poor, mate".

    --
    dorayme
    dorayme, Jan 3, 2009
    #12
  13. Ramon

    Jani Guest

    On 3 Jan., 12:40, Ramon <> wrote:
    > Hi,
    >
    > Does someone here knows if there exists a tag that can fold/hide text...
    > and when the user clicks it, the text will become visible.
    >
    > Thanks


    What about event listeners?
    Also javascript but you can sit long time to get a nice hotspot or
    image-map matrix:
    a mouse over here - some text there. But only for a more grafical
    realization. Like the buttons of a mobile phone.
    Jani, Jan 3, 2009
    #13
  14. Jani wrote:

    > What about event listeners?


    Event listeners *is* JavaScript, not HTML. HTML cannot *do* anything, it
    is not a programming language, it is markup only, HyperText Markup
    Language...

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jan 3, 2009
    #14
  15. Ramon

    Chaddy2222 Guest

    On Jan 4, 1:55 pm, Ed Mullen <> wrote:
    > Ramon wrote:
    > > Thanks Ed for your tips.  It worked great!

    >
    > > Ed Mullen wrote:
    > >> Ramon wrote:
    > >>> Hi,

    >
    > >>> Does someone here knows if there exists a tag that can fold/hide
    > >>> text... and when the user clicks it, the text will become visible.

    >
    > >>> Thanks

    >
    > >> You need javascript but there are lots of existing examples:

    >
    > >>http://markehansen.07x.net/FAQ.htm

    >
    > >>http://www.tjkdesign.com/articles/toggle_elements.asp

    >
    > >> Google text toggle for more.

    >
    > HTH.  Just remember that you need to also account for the minority of
    > browsers who visit and have javascript turned off.
    >

    What, like Googlebot for example!
    --
    Regards Chad. http://freewebdesignonline.org
    Chaddy2222, Jan 4, 2009
    #15
  16. Ramon

    Neredbojias Guest

    On 03 Jan 2009, Els <> wrote:

    > Neredbojias wrote:
    >> On 03 Jan 2009, Ramon <> wrote:
    >>
    >>> Does someone here knows if there exists a tag that can fold/hide
    >>> text... and when the user clicks it, the text will become visible.

    >>
    >> How would the user be able to click it when it's invisible?

    >
    > nitpick! ;-)


    I used to be a nice guy but dorayme burned out all my gentler
    sensibilities.

    --
    Neredbojias
    http://www.neredbojias.org/
    http://www.neredbojias.net/
    The road to Heaven is paved with bad intentions.
    Neredbojias, Jan 4, 2009
    #16
  17. Ramon

    houghi Guest

    Chaddy2222 wrote:
    >> HTH.  Just remember that you need to also account for the minority of
    >> browsers who visit and have javascript turned off.
    >>

    > What, like Googlebot for example!


    No, firefox, Internet Explorer, Opera and others where people have
    decided to turn off javascript.

    houghi
    --
    This was written under the influence of the following:
    | Artist : Henny Vrienten
    | Song : Kom in de zon
    | Album : Mijn Hart Slaapt Nooit
    houghi, Jan 4, 2009
    #17
  18. Ramon

    Jani Guest

    On 3 Jan., 23:19, "Jonathan N. Little" <> wrote:

    > Event listeners *is* JavaScript, not HTML. HTML cannot *do* anything, it
    > is not a programming language, it is markup only, HyperText Markup
    > Language...


    But the browser can do it for you [1]
    And you can add a little JavaScript. [2] The W3C also handle a little
    bit with events.

    [1]

    <style type="text/css">
    <!--
    a:link {
    color: #FFFFFF;
    text-decoration:none;
    }
    a:visited {
    color: #FFFFFF;
    }
    a:active {
    color: #FF0000;
    }
    ..green { color: #00CC00 }
    -->
    </style>
    </head>

    <body>
    <a href=""><span style="color:black">[+] Hello! Me I am the first
    line.</span>
    <br />
    <br />
    <span class="green">Here</span> is some more text.<br />
    Here <span class="green">is</span> some more text.<br />
    Here is <span class="green">some</span> more text.<br />
    Here is some <span class="green">more</span> text.<br />
    Here is some more <span class="green">text.</span><br /> </a>
    </body>




    [2]

    <body>


    <script type="text/javascript">
    <!--
    document.writeln('<table cellspacing="0" cellpadding="0">');
    for(i=0 ; i<20 ; i++)
    {
    document.writeln('<tr>');
    for(j=0 ; j<20 ; j++)
    {

    k = i*20 + j + 2*i;
    l = k + 1;
    m = k + 2;
    n = k - 1;
    o = k - 2;

    p = k - 22;
    q = k - 44;
    r = k + 22;
    s = k + 44;

    document.writeln('<td><img src="yellow.gif" id="' + k + '"
    onMouseOver="document.getElementById(\'' + l + '\').src=\'blue.gif\',

    document.getElementById(\'' + m + '\').src=\'blue.gif\',
    document.getElementById(\'' + n + '\').src=\'blue.gif\',
    document.getElementById(\'' + o +

    '\').src=\'blue.gif\', document.getElementById(\'' + p + '\').src=
    \'blue.gif\', document.getElementById(\'' + q + '\').src=\'blue.gif
    \',

    document.getElementById(\'' + r + '\').src=\'blue.gif\',
    document.getElementById(\'' + s + '\').src=\'blue.gif\'"
    onMouseOut="document.getElementById(\'' + l

    + '\').src=\'yellow.gif\', document.getElementById(\'' + m + '\').src=
    \'yellow.gif\', document.getElementById(\'' + n + '\').src=\'yellow.gif
    \',

    document.getElementById(\'' + o + '\').src=\'yellow.gif\',
    document.getElementById(\'' + p + '\').src=\'yellow.gif\',
    document.getElementById(\'' + q +

    '\').src=\'yellow.gif\', document.getElementById(\'' + r + '\').src=
    \'yellow.gif\', document.getElementById(\'' + s + '\').src=\'yellow.gif
    \'"></td>');

    }
    document.writeln('</tr>');
    }
    document.writeln('</table>');
    //-->
    </script>

    </body>
    Jani, Jan 4, 2009
    #18
  19. Jani wrote:
    > On 3 Jan., 23:19, "Jonathan N. Little" <> wrote:
    >
    >> Event listeners *is* JavaScript, not HTML. HTML cannot *do* anything, it
    >> is not a programming language, it is markup only, HyperText Markup
    >> Language...

    >
    > But the browser can do it for you [1]
    > And you can add a little JavaScript. [2] The W3C also handle a little
    > bit with events.
    >


    Okay, I will try to explain this to you. JavaScript is not HTML. Already
    mentioned in thread this cannot be done with HTML but would need
    JavaScript. The problem is JavaScript is optional, so the usual caveats
    apply. The functionality of the page *must* preserved if JavaScript is
    not enabled. So the page should be in a fully readable state when
    JavaScript is not present.

    > [1]
    >
    > <style type="text/css">
    > <!--

    ^^^^^^
    Stop putting HTML within STYLE elements. They are *not* required as so
    many erroneously believe.

    > a:link {
    > color: #FFFFFF;
    > text-decoration:none;
    > }
    > a:visited {
    > color: #FFFFFF;
    > }
    > a:active {
    > color: #FF0000;
    > }
    > .green { color: #00CC00 }
    > -->
    > </style>
    > </head>
    >
    > <body>
    > <a href=""><span style="color:black">[+] Hello! Me I am the first

    ^
    Having an empty HREF is not a good idea, can have unwanted side effects.
    Far better to attach an onclick handler directly to the element, in your
    example it would be the SPAN, however I would think DIV of would be
    more appropriate.

    > line.</span>
    > <br />
    > <br />
    > <span class="green">Here</span> is some more text.<br />
    > Here <span class="green">is</span> some more text.<br />
    > Here is <span class="green">some</span> more text.<br />
    > Here is some <span class="green">more</span> text.<br />
    > Here is some more <span class="green">text.</span><br /> </a>

    ^^^^
    Hmm using XHTML? In most cases, this is a very bad idea which has been
    discussed ad nauseam. If you using strict then your "document.writeln"
    statements are a *no-no!* JavaScript is optional, functionality of the
    page *must* preserved if JavaScript is not enabled.


    > </body>
    >
    >
    >
    >
    > [2]
    >
    > <body>
    >
    >
    > <script type="text/javascript">
    > <!--
    > document.writeln('<table cellspacing="0" cellpadding="0">');


    "document.writeln" are usually a bad idea, and in your application,
    absolutely a bad idea. Why? Because if the client has JavaScript
    disabled he will see *nothing*. Remember above?

    <snip code>

    If I where to recommend a way to do this here is the parameters that I
    would say are appropriate.

    1. Create the full *static* page with all elements in the visible and
    readable state. This includes this initial state defined in the CSS,
    remember CSS is optional too!

    2. Put all your JavaScript in an *external* file.

    3. Related to #2, do not pepper your markup with handler attributes,
    i.e., all those "onclick=" but instead attach the handlers with your
    functions in your JavaScript. Of course MS's contrariness means code forks!

    function someClickHandler(){
    ...
    }

    function initClickHandler(targetID){
    var target=documentGetElementBtId(targetID);
    if(target){
    if(target.addEventListener){ //modern browsers
    target.addEventListener('click', someClickHandler, false);
    }
    else if(target.attachEvent){ //Old MS IE support
    target.attachEvent('onclick', someClickHandler);
    }
    else {
    //ain't supported so do nothing
    }
    }
    }

    // function to call all your event handler inits
    function attachMyEvents(){
    initClickHandler();
    // any other init functions add to list
    ...
    }

    //now set to page loads to set it all up
    // attach event after page loads
    if( window.addEventListener ) {
    window.addEventListener('load',attachMyEvents,false); //legacy DOM
    } else if( document.addEventListener ) {
    document.addEventListener('load',attachMyEvents,false); //proper DOM
    } else if( window.attachEvent ) {
    window.attachEvent('onload', attachMyEvents); //Damn IE only
    }



    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jan 4, 2009
    #19
  20. Jonathan N. Little wrote:
    > Jani wrote:
    >> On 3 Jan., 23:19, "Jonathan N. Little" <> wrote:


    >>
    >> <style type="text/css">
    >> <!--

    > ^^^^^^
    > Stop putting HTML within STYLE elements. They are *not* required as so


    Correction: Stop putting HTML *comments* within STYLE elements.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jan 4, 2009
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Learner
    Replies:
    1
    Views:
    984
    Marina Levit [MVP]
    Jan 30, 2006
  2. Anonymous
    Replies:
    0
    Views:
    1,457
    Anonymous
    Oct 13, 2005
  3. David Gordon

    xpath query query

    David Gordon, May 18, 2005, in forum: XML
    Replies:
    2
    Views:
    787
    David Gordon
    May 18, 2005
  4. Eric Nelson
    Replies:
    5
    Views:
    1,525
    Alexey Smirnov
    Feb 4, 2009
  5. Jon F.

    CAML Query: Multiple Query Fields Issue

    Jon F., May 12, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    754
    Jon F.
    May 12, 2004
Loading...

Share This Page