Search & Replace in javascript

August 1, 2007 at 4:50 am Leave a comment

<script language=”javascript”>
myvar=”test page”;                     //define a variable“page”);       //sear is a variable which holds result of search
if(sear==5)                                       // out put will be number
oldvar=”hello there”;
newvar=oldvar.replace(“there”,”suresh”);       //replacing there by suresh
document.write(newvar);                      //output will be “hello suresh”


Entry filed under: Javascript. in js when popup is blocked Formating / multi formating strings in javascript

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Flickr Photos

Blog Stats

  • 720,244 hits

%d bloggers like this: