Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Aug 2004
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    How to make the text very tiny using when printing the output of a javascript.

    Can someone help me with this... I want to make the font size so small its impossible to read... I know it can't be done like this but it does clearly show what I want to accomplish. I could also make the font color the same as the background... that would work also... Appreciate the help..
    This script is called on every page so I don't want to mess with the normal font on the page just this quick instance when "Hello Dolly" is printed then go back to whatever font is normally used on the page.

    Code:
    <script>
    var imageURL = ('Hello Dolly.');
    <font size = xx-small>
    document.write(imageURL);
    </font>
    </script>
    Free Pay Per Click Site http://www.52payperclick.com How would you like a totally free 20,000 keyphrase Google Adwords PPC site and be trained to operate it. I specialize in Real Estate, but can set you up in any Niche. Totally Free... Check out the URL above or Visit my site about Virginia Beach Homes at http://vahud.com

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    document.write() in JavaScript is obsolete.

    the <font> tag is obsolete.

    Code:
    <span id="invisible" style="font-size: 1px; color: white;"></span>
    ...
    <script type="text/javascript">
    document.getElementById("invisible").innerHTML = "Hello, Dolly";
    </script>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    tommytx (07-11-2013)

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,465
    Thanks
    0
    Thanked 634 Times in 624 Posts
    You can't control what displays when people view the page source.

    even if you could the browser owner can override any CSS or JavaScript that you have with their own so your 1px text the same colour as the background can be displayed on their browser at 20px in a contrasting colour.

    There is no way to conceal what you have in your JavaScript (or HTML or CSS). The browser needs to have access to it to display the web page and any "protection" you apply can be easily done using a commonly available web page decryption program (more commonly known as a web browser).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    All Felgall says is of course true. But you *will* be hiding it from 99% of all visitors. If it's not something really secret, that's surely good enough. If it is secret, then don't put it on an open web site.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,731
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Quote Originally Posted by Old Pedant View Post
    All Felgall says is of course true. But you *will* be hiding it from 99% of all visitors. If it's not something really secret, that's surely good enough. If it is secret, then don't put it on an open web site.
    What on earth is the purpose of displaying text which is impossible to read? Sounds like terms and conditions!

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #6
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,026
    Thanks
    36
    Thanked 494 Times in 488 Posts

    Arrow

    Quote Originally Posted by Philip M View Post
    What on earth is the purpose of displaying text which is impossible to read? Sounds like terms and conditions!
    Sounds to me like a lawyer!

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,465
    Thanks
    0
    Thanked 634 Times in 624 Posts
    The other thing of importance is that the search engines know about all the ways to make the text harder for real visitors to read and penalise web pages that use them by placing them far lower in their results (if they list the page at all).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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