Computer problems,Computer help
*AX SOFT>>>Programming & Design

HTML and Javascript Program?


HI
Can anyone help me write code for this question

Design an HTML page to accept any string and do the following by providing command buttons:
a. Display length of the string
b. Display each character on a new line
c. Replace all blank spaces with 鈥?鈥?symbol.
d. Accept a character from the user and display the occurrence of the same in a string.
e. Display no. of words in a string.

<script type="text/javascript">
function leng()
{
var str=document.form1.getinput.value;
alert("length of String : " +str.length);
}
</script>
<form name=form1>
<P>
Enter the Sentence : <input type="text" name="getinput" >
<br><br>
Click Button to perform its
action:</P>
<P>
<br>

<input type="button" value="Length of String" OnClick="leng()" name=button1>

<input type="button" value="Display each char" onclick="eachchar()" name=button2>
<input type="button" value="Blank space with '#'" onclick="blank()" name=button3>
</P>
<P>聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
<input type="button" value="Occurrence" onclick="occur() " name=button4>
<input type="button" value="No of Words" onclick="word()" name=button5>
</P>
</form>

php is easier than javascript so better use php for that

First create a test.htm file. In that create a text box using <input type="text" name="txtString"/>
then create 5 buttons using
<input type="button" name="btnLength" value="Length" onclick="javascript:findLength();"/>
then write javascript in between head tag in the same page.
function findLength()
{
alert(your control name.length);
}

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • I need a logo for my Construction firm?

    Why don't you search existing logo sites to get ideas? Here are some to try - Logo Search - ...

  • How do you make this into an animated gif?

    i got the flash file from ...

  • I.E. 7 View Problem?

    Use Mozilla Firefox bro!

    ...
  • Web Design Languages?

    It's always good to know as many languages as possible. Of course you won't have the time to master everyone, but you don't need to - that would be time prohibitive. PHP is a good...

  • How do you cut an avi. file into 2 pieces?

    OK, Basically you require a movie splitter rather than a file splitter. File splitters cut the files into required fragments logically. You may or may not open the file individually. Movi...

  • Adobe Indesign Serial Code?

    you should just be able to replace your original "Public.dll" [without the quotation marks] with the backup you have. Public.dll contains the key but is really hard to extract. better ...

  • Help with designing a new font?

    There are softwares available which will help you in converting this font which you have ( screen shot ) into TTF ( Windows ). Search google forr tutorials/articles/blog log on to ...

  • Need some help in visual basic..?

    hi, i think u didn't install properly..so go to control panel->choose add or remove programs->uninstall and install again...

    ...
  •  

    Categories--Copyright/IP Policy--Contact Webmaster