Results 1 to 8 of 8

Thread: Writing text on whole page

  1. #1

    Thread Starter
    Addicted Member Mr.Joker's Avatar
    Join Date
    Apr 2012
    Posts
    140

    Writing text on whole page

    I had an idea to repeat same code as I saw on the internet few days ago. It looked like this: On whole screen there were numbers like 0 and 1 (binary system) and those numbers constantly changed value from 0 to 1 and reverse. It was fast but not lighting speed, the speed normal to enjoy the change. I'd like to do that also but when I try to type whole bunch of numbers on the webpage using javascript I just can't find the way. Can anyone help me with that?

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Writing text on whole page

    Use loops to repeat printing it. Inside it, you could add conditions to swap printing of the 0's or 1's on each iteration. Or you could use the Math.random() function which generates a random number.

    You could use it like this on each iteration:
    Code:
    num = Math.round(Math.random());
    Or are you talking about the numbers in the screen fading to another one and viceversa or something like that ? Can you post the link to that page ?


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Addicted Member Mr.Joker's Avatar
    Join Date
    Apr 2012
    Posts
    140

    Re: Writing text on whole page

    It was hacked website of some gouvernment, but now there us nothing. I am not interested in hacking for sure, just wanted to see how to make that effect with javascript. It looked like this:
    -Whole page with numbers 0 and 1 .
    -Small font-size of those numbers.
    -Low opacity of font.
    -When website load the numbers start changeing from 0 to 1 and reverse.
    I tried random number but all numbers go in same row and keep going forever.

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Writing text on whole page

    Instead of using JavaScript for this, we could use an animated gif background! That is, create a gif animated image of 0 transforming to 1. Then, use this as the page background with repeated on both x and y direction.

    I have created a demo animated gif using Adobe Imageready (see the attached image).

    And the demo html code would look something like this:
    HTML Code:
    <html>
    <head>
        <style>
            body{background-image: url(01.gif);}
        </style>
    </head>
    </html>
    Here's a live demo (probably works for VBF logged in users only): http://jsfiddle.net/w5KLa/

    Hope it helps
    Attached Images Attached Images  
    Last edited by akhileshbc; Oct 24th, 2012 at 05:02 AM.

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  5. #5

    Thread Starter
    Addicted Member Mr.Joker's Avatar
    Join Date
    Apr 2012
    Posts
    140

    Re: Writing text on whole page

    Oh ok. But the question I asked here was because I wanted to learn this part with javascript. I know also to do that with Photoshop but thanks again for giving me that idea. Just wanted to see how that work with js.

  6. #6
    Hyperactive Member coothead's Avatar
    Join Date
    Oct 2007
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    284

    Re: Writing text on whole page

    Hi there Mr.Joker

    Here is an example for you to play with....
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    
    <title>binary page</title>
    
    <style type="text/css">
    html,body {
        height:100%;
        margin:0;
        overflow:hidden;
        background-color:#111;
     }
    #newtable td {
        padding:4px;
        font-family:'courier new',monospace;
        font-size:32px;
        color:#eee;
     }
    </style>
    
    <script type="text/javascript">
    
    function init(){
    
       speed=1500;  /* this value is editable */
    
       row=[];
       cell=[];
    
       rowNum=40; 
       cellNum=80; 
    
       tab=document.createElement('table');
       tab.setAttribute('id','newtable');
    
       tbo=document.createElement('tbody');
    for(c=0;c<rowNum;c++){
       row[c]=document.createElement('tr');
    
    for(k=0;k<cellNum;k++) {
       cell[k]=document.createElement('td');
       cont=document.createTextNode(Math.floor(Math.random()*2))
       cell[k].appendChild(cont);
       row[c].appendChild(cell[k]);
     }
       tbo.appendChild(row[c]);
     }
       tab.appendChild(tbo);
       document.body.appendChild(tab);
       swapnumbers()
     }
    
    function swapnumbers() {
    
       cells=document.getElementById('newtable').getElementsByTagName('td');
       numbers=cells.length;
    
    for(c=0;c<numbers;c++) {
       cells[c].firstChild.nodeValue=Math.floor(Math.random()*2);
     }
      setTimeout(function(){swapnumbers()},speed);
    
     }
    
       window.addEventListener?
       window.addEventListener('load',init,false):
       window.attachEvent('onload',init);
    
    </script>
    
    </head>
    <body>
    
    <div></div>
    
    </body>
    </html>
    


    ~ the original bald headed old fart ~

  7. #7

    Thread Starter
    Addicted Member Mr.Joker's Avatar
    Join Date
    Apr 2012
    Posts
    140

    Re: Writing text on whole page

    Thanks man. Wish I can give you both reputation .

  8. #8
    Hyperactive Member coothead's Avatar
    Join Date
    Oct 2007
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    284

    Re: Writing text on whole page

    No problem, you're very welcome.


    ~ the original bald headed old fart ~

Posting Permissions

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



Click Here to Expand Forum to Full Width