Jump to content

My new achievemet


crazy_cat_luv_bb

Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...