Menu
Hi,
I need a bit help, in the code below I an trying to replace a string with another string, then write the new string in JavaScript tags. But the result is not what I wanted: first the original string was not replaced, second plain text is shown, instead of popping up an alert. Is there a way I can replace the string and execute the command?
Any help is appreciated!
[CODE]<html>
<body>
<script type=”text/javascript”>
var str=”alert(“sometext”)”;
str.replace(“alert(“sometext”)”,”alert(“some new text”);” );
</script>
<script type=”text/javascript”>
document.write(str);
</script>
</body>
</html>