Hi,
I am trying to replace smilies in the code with there respective images but I am facing a strange problem .... take a look at my code
as u can see the code will work perfectly like this but if I comment line 2 and uncomment line 1 it will not work ... and I can't know why .... I hope someone can help
I am trying to replace smilies in the code with there respective images but I am facing a strange problem .... take a look at my code
Code:
<html>
<head>
</head>
<body>
this is body text ha ha ha :) :)
<input type="submit" name="myButton" id="myButton" />
<script type="text/javascript">
var myButton = document.getElementById("myButton");
myButton.onclick = function() {
var myBody = document.body.innerHTML;
//var re = new RegExp(":)","gi"); // line 1
var re = new RegExp("o","gi"); // line 2
myBody = myBody.replace(re, "[IMG]");
document.body.innerHTML = myBody;
};
</script>
</body>
</html>
as u can see the code will work perfectly like this but if I comment line 2 and uncomment line 1 it will not work ... and I can't know why .... I hope someone can help