Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Hiding text

  1. #1
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Hiding text

    Hi everyone!

    I've been trying to find a script that hides text!

    what I mean, I have a warning sentense that I want to enable the use to dismiss it so it disappears without reloading the page!?

    any help out there?

    many thanks in advance!

    Mo

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That's not very clear, yet.

    What is it warning? Is this a user-controlled thing, or will it check something (if there is a plugin, if an image loaded, etc.)?

    You should be able to use javascript to change the CSS property of visibility to make it dissapear, though.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <span onclick="this.parentNode.removeChild(this);">Click here to remove this text!</span>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That's nice. Easy, too.

    Might be more fun with:
    Code:
    <span style="background-color: #FFFF00;" onclick="this.parentNode.removeChild(this);">Click here to remove this text!</span>
    (though you can do whatever you want, within that span)
    Last edited by thetestingsite; 05-09-2007 at 01:47 AM. Reason: making the color an easier one to read
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    am afraid it's not working.
    am getting the message "Click here to remove this text!" but plain text without a link, any suggestions? is there something you assume am writing before that?

    One more thing, what about if I want to hide the text by clicking on one word not the entire thing, example:
    This site has been updated ( dismiss )
    here i want the user to be able to click on ( dismiss ) so the sentence before disappears

    Many thanks for the help !!

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The message is set with the onClick attribute, so it should dissapear. It works for me, anyway.
    It won't seem to be a link, though you could format it as such (underline, cursor: hand;, etc.), or make it a link to "#", etc.

    As for (dismiss), that might be harder.

    I'm guessing, on the span tag, then, use:
    onclick="this.parentNode.parentNode.removeChild(this);"
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    HTML Code:
    <a href="#" onclick="this.parentNode.removeChild(this);">Click here to remove this text!</a>
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  8. #8
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Many thanks, problem solved!

    cheers, Moh

  9. #9
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Or the following one

    Code:
    <span onclick="this.parentNode.removeChild(this);" style="text-decoration:underline;" onmouseover="this.style.cursor='hand';this.style.cursor='pointer';">Click here to remove this text!</span>

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    codeexploiter's is preferable... it's not a link, so using <a> is an abuse of the element, and may confuse people without Javascript.
    onclick="this.parentNode.parentNode.removeChild(this);"
    Not quite...
    Code:
    <p>
      Some text (
      <span onclick="this.parentNode.parentNode.removeChild(this.parentNode);">
        dismiss
      </span>
      )
    </p>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •