C# Corner
Tech
News
Videos
Forums
Trainings
Books
Live
More
Interviews
Events
Jobs
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Javascript-Replace string with your new string.
WhatsApp
Ghanashyam Nayak
5y
5
k
0
0
25
Blog
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
>
<html>
<head>
<title>Sample Code</title>
<script type=
"text/javascript"
>
function
ReplaceMyString(strBeforeReplace,strOld,strNew)
{
var
strAfterReplace = strBeforeReplace.replace(strOld, strNew);
alert(strAfterReplace);
}
</script>
</head>
<body bgcolor=#00ff00 alink=blue vlink=blue>
<FORM name=
"windowEvent"
>
Enter String : <input type=
"text"
name=
"txtBeforeReplace"
/><br>
What You Want To Replace? : <input type=
"text"
name=
"txtOldReplace"
/><br>
For With You Want To Replace? : <input type=
"text"
name=
"txtNewReplace"
/><br>
<input type=
"button"
value=
"Check"
name=
"btnNumber"
onClick=
"ReplaceMyString(txtBeforeReplace.value,txtOldReplace.value,txtNewReplace.value);"
/>
</FORM>
</body>
</html>
People also reading
Membership not found