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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Display all "Digit Numbers" in webpage

    Hi,
    I want to when I open a web page , my program detect all the "digit numbers"
    and display all of them for me.

    I don't know exactly what do I do?

    Thanks.
    Regards.

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    Detect? There is an infinite number of digit numbers ... where to detect? Where to show? What do you have?

  • #3
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Quote Originally Posted by devnull69 View Post
    Detect? There is an infinite number of digit numbers ... where to detect? Where to show? What do you have?
    I want to display all digits in my web page

  • #4
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    Sorry ... you cannot display all digits on one web page

    EDIT: Aah digits ... decimal digits are only 0, 1, 2, .... 9 ... so it's easy to display them
    Code:
    for(i=0; i<10; i++) {
       document.write(i + "<br/>");
    }

  • #5
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by devnull69 View Post
    Sorry ... you cannot display all digits on one web page

    EDIT: Aah digits ... decimal digits are only 0, 1, 2, .... 9 ... so it's easy to display them
    Code:
    for(i=0; i<10; i++) {
       document.write(i + "<br/>");
    }
    thanks, but for example I have a page that character + decimal digits are, so I want to by javascrip select all decimal digits and display just them.

  • #6
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    So you are on a page (your page) and you just want to extract all decimal digits and display them? But they are being displayed already ... where do you want to display them? Do you really mean digits or do you rather mean "full numbers"?

  • #7
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by devnull69 View Post
    So you are on a page (your page) and you just want to extract all decimal digits and display them? But they are being displayed already ... where do you want to display them? Do you really mean digits or do you rather mean "full numbers"?
    all the numbers in that page

  • #8
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,732
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    And the point of this is....?

    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
    </head>
    
    <script type="text/javascript" >
    
    window.onload=function(){
    var str = document.getElementsByTagName('html')[0].innerHTML;
    //var str = document.getElementsByTagName('body')[0].innerHTML;  // string to be found must be in body
    var x = str.match(/\d+/g);  // digits
    alert (x);
    }
    </script>
    
    12345
    67890
    98765
    
    </body>
    </html>
    I take it that you do understand that you can only detect the digits appearing in your own page, and not some other web page.
    Last edited by Philip M; 04-17-2012 at 12:15 PM.

    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.


  •  

    Posting Permissions

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