8. Write a JavaScript to find a string from the given text. If the match is found then replace it with another string.
<html>
<head>
<title>EX-8: WTAD : www.bipinrupadiya.com</title>
<script language="javascript">
var temp=new Array();
function findMyStr()
{
myStr=(document.getElementById("txt1").value);
str2bSearch=(document.getElementById("txt2").value);
myStr_length=myStr.length;
str2bSearch_length=str2bSearch.length;
for(i=0;i<myStr_length;i++)
{
temp[i]=myStr.substring(i,str2bSearch_length+i);
}
for(i=0;i<temp.length;i++)
{
if(temp[i]==str2bSearch)
{
found=true;
break;
}
else
{
found=false;
}
}
if(found==true)
document.getElementById("msg").innerHTML='String found ...';
else
document.getElementById("msg").innerHTML='string not found';
}
</script>
</head>
<body>
<br>Enter String : <input type="Text" ID="txt1">
<br>Search String : <input type="Text" ID="txt2">
<br><input type="button" value=" SEARCH" onClick="findMyStr()">
<div id="msg" style="color:red"></div>
</body>
</html>
<head>
<title>EX-8: WTAD : www.bipinrupadiya.com</title>
<script language="javascript">
var temp=new Array();
function findMyStr()
{
myStr=(document.getElementById("txt1").value);
str2bSearch=(document.getElementById("txt2").value);
myStr_length=myStr.length;
str2bSearch_length=str2bSearch.length;
for(i=0;i<myStr_length;i++)
{
temp[i]=myStr.substring(i,str2bSearch_length+i);
}
for(i=0;i<temp.length;i++)
{
if(temp[i]==str2bSearch)
{
found=true;
break;
}
else
{
found=false;
}
}
if(found==true)
document.getElementById("msg").innerHTML='String found ...';
else
document.getElementById("msg").innerHTML='string not found';
}
</script>
</head>
<body>
<br>Enter String : <input type="Text" ID="txt1">
<br>Search String : <input type="Text" ID="txt2">
<br><input type="button" value=" SEARCH" onClick="findMyStr()">
<div id="msg" style="color:red"></div>
</body>
</html>
Subscribe to:
Post Comments (Atom)
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- c (11)
- Configure Tomcat7 (2)
- CSS (3)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- install Tomcat (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- linux (8)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- shell script (33)
- unix (22)
- WTAD (34)
Blog Archive
-
▼
2012
(79)
-
▼
January
(16)
- 15. Assume that we have got three pdf files for th...
- 14. Write a Servlet which displays a message and a...
- 13. Write a Servlet to display all the attributes ...
- 12. Write a Servlet to display parameters availabl...
- 11. Write a Servlet to display all the headers ava...
- create GenericServlet
- 9. Write a JavaScript to show a pop up window with...
- 8. Write a JavaScript to find a string from the gi...
- 7. Write a JavaScript to convert Celsius to Fahren...
- 6. Write a JavaScript to remove the highest elemen...
- 5. Write a JavaScript to generate two random numbe...
- 4. Write a JavaScript that finds out multiples of ...
- 3. Create a Form in HTML with two fields, minimum ...
- 2. Write a JavaScript that demonstrates the use of...
- 1. Write a JavaScript that shows how a variable’s ...
- getting "android write to sdcard permission denied...
-
▼
January
(16)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.
2 comments:
Thanks for sharing this page.I learned how to find the string from this page.
Regards,
JAVA Training in Chennai | JAVA course in Chennai
This is the awesome post and I have huge information from your creative blog. The admin presented the content is very interesting and also comprehensive. Thank you for your sharing, Keep updating...
Oracle Training in Chennai
Oracle Training institute in chennai
Tableau Training in Chennai
Spark Training in Chennai
Pega Training in Chennai
Unix Training in Chennai
Power BI Training in Chennai
Oracle DBA Training in Chennai
Oracle Training in Chennai
Oracle Training institute in chennai
Post a Comment