crazy_cat_luv_bb Posted March 17, 2013 Posted March 17, 2013 Ok, so the last 2 or 3 weeks I was working on my Science Fair Project about Computer Programming. I worked days and nights, and though it was late to the due date, I still feel good. My project is about JavaScript, which I don't know really much, and I needed a lot of help from variety of websites to help me out. Ok, so this is my code: <html> <head> <title>Text Analysis</title> <style type="text/css"> textarea {resize:none; overflow-y:scroll; overflow-x:hidden;} </style> <script type="text/javascript"> function myFunction () { var formcontent=document.wordcount.wordcount2.value formcontent=formcontent.split(" ") document.wordcount.wordcount3.value=formcontent.length } function myFunction2 () { var formcontent=document.wordcount.wordcount2.value var formcontent=formcontent.replace("...", ".") .replace("?", ".") .replace("!", ".") .split("."); document.wordcount.wordcount4.value=formcontent.length } function myFunction3 () { var formcontent=document.wordcount.wordcount2.value var formcontent=formcontent.split(" ").join("") document.wordcount.wordcount5.value=formcontent.length } </script> </head> <body> <form name=wordcount><b>Paste the document in the text area below:</b> <br> <textarea name="wordcount2" rows=20 cols=75 wrap="on"></textarea> <br> <input type="button" value="Analyze" onclick="myFunction();myFunction2();myFunction3();"> <br><br><br> <b>Statistics:</b> <br> <br> Number of words containing in the text <input type="text" name="wordcount3" size=5 readonly> <br><br> Number of sentences containing in the text <input type="text" name="wordcount4" size=5 readonly> <br><br> Number of characters (w/o spaces) containting in the text <input type="text" name="wordcount5" size=5 readonly> </body> </html> P/s: I just want to share to everybody :D Quote
karmacow Posted March 18, 2013 Posted March 18, 2013 I'm not really sure what I'm looking at, but well done on completing your project :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.