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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 1 Time in 1 Post

    Post prime-number-generator

    write any number in and the browser will give out the primes who exist until your number.
    Code:
    <html>
    <head>
    	<script type="text/javascript">
    
    function addInput(form) {
    var up = form.inputbox.value;
    for (x=0; x<=up; x++){
    		count = 0;
    		for (y=0; y<=x; y++){
    			g = x/y;
    			if (g%1===0){
    				count += 1;
    			}
    		}
    	y=0;
    	if (count === 1){
    		document.write(x + "<br>");
    	}
    	if (count === 2){
    		document.write(x + "<br>");
    	}
    }
    }
    </script>
    	
    </head>
    <body>
    <div style="font-family:arial;">Prime-generator</div><p>
    <div style="font-size:10px; font-family:arial;">some text for description.</div><p>
    <form name="form" method="get">
    	<input type="text" name="inputbox" value=""/>
    	<input type="button" onclick="addInput(this.form)" name="button" value="go"/>
    </form>
    </body>
    </html>
    }
    Last edited by vasech; 08-26-2012 at 09:10 PM. Reason: supplement

  2. Users who have thanked vasech for this post:

    vnit969 (09-12-2012)

  • #2
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    prime-number-generator

    Nice work


  •  

    Tags for this Thread

    Posting Permissions

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