Hi, following code depicts how a string with HTML tags, is converted to a string without any tags.
<HTML>
<HEAD>
<TITLE> Remove HTML tags </TITLE>
</HEAD>
<BODY onload="demo();">
<SCRIPT LANGUAGE="JavaScript">
function demo()
{
var orignal= '<p align="Left"><b>I</b> <I>Rock!</I></p>';
var modified = orignal.replace(/(<([^>]+)>)/ig,"");
alert(orignal);
alert(modified);
}
</SCRIPT>
</BODY>
</HTML>
Keeps Coding! :)
<HTML>
<HEAD>
<TITLE> Remove HTML tags </TITLE>
</HEAD>
<BODY onload="demo();">
<SCRIPT LANGUAGE="JavaScript">
function demo()
{
var orignal= '<p align="Left"><b>I</b> <I>Rock!</I></p>';
var modified = orignal.replace(/(<([^>]+)>)/ig,"");
alert(orignal);
alert(modified);
}
</SCRIPT>
</BODY>
</HTML>
Keeps Coding! :)
0 comments:
Post a Comment