<script type="text/javascript">
//this won't display the text "<table>" and "</table>"
document.write("<table>");
document.write("</table>");
</script>
//this won't display the text "<table>" and "</table>"
document.write("<table>");
document.write("</table>");
</script>
The above script won't work. The screen will show nothing because the browser interprets the string as HTML table tags. To work around this, split the string that contains tags to be displayed into parts:
<script type="text/javascript">
document.write("<ta" + "ble>");
document.write("</tab" + "le>");
</script>
document.write("<ta" + "ble>");
document.write("</tab" + "le>");
</script>
Happy coding and don't forget to comment :)
No comments:
Post a Comment