Code: Select all
<head>
<script type="text/javascript">
function change(){
var x = document.getElementById("myCode");
var y = x.innerHTML;
y= y.replace(/</g, "<")
y= y.replace(/>/g,">")
document.getElementById('myCode').innerHTML = y;
}
</script>
</head>
<body onload="change();">
<div id="myCode">
<?php echo 'Batman'; ?>
</div>
</body>
If you haven't already figured out, I want to replace the "<" and the ">", so the code is being displayed, not executed.
Any suggestions?