When I see examples of code on web pages, I sometimes wish I could test them immediately, rather than loading a test page or creating my own test page.
With this in mind, I have added a sprinkling of JavaScript, making use of eval
(gasp), to let you test code snippets and edit them, inline as it were.
Indeed I feel that this is a legitimate use of eval
, and perhaps a good reason for ensuring that it is retained in the language.
I have called this CodePlay, and, obviously, it does require JavaScript.
There are three types, with examples below:-
CodePlay
This lets you edit and run JavaScript snippets.
alert("A bit of JavaScript");
HTMLPlay
This lets you edit and display HTML snippets.
<p style="margin-left:10px; border:1px solid blue; padding:5px;">Some HTML</p>
PagePlay
This shows a whole web pages using either an iframe
or window.open
to show the page contents. The latter may not work if you have pop-up blocking switched on.
<html>
<body>
<p style="margin-left:10px; border:1px solid blue; padding:5px;">Some HTML</p>
</body>
</html>
Sorry, comments have been suspended. Too much offensive comment spam is causing the site to be blocked by firewalls (which ironically therefore defeats the point of posting spam in the first place!). I don't get that many comments anyway, so I am going to look at a better way of managing the comment spam before reinstating the comments.