html sans html

This semester, I'm teaching a course in Discrete Computational Structures for my first time in a couple of decades. It's sorta like discrete math, but with programming rather than proofs as the grey matter in which the little chunks are suspended.
 
I thought I'd try to use JavaScript as the programming environment, use a plain text editor as the development environment and a random web browser as the run-time environment. No frills, no wasting time on magical incantations and job control language. Accordingly I thought I'd remove the HTML part of the JavaScript and just use prompt() for input and alert() for output. It all made sense to me:
 
a simple program to echo a user's input: 
<script>n=prompt("hello"); alert(n)</script>
No need for my students to learn any HTMLx (x={1,2,3,4,...}), no need for DOMn (n={1,2,3,...}), just bare bones scripting with less hoopla and nonsense, even, than fortran, pascal, C, or Java! How pleasant! *
 
Well, having seen a recent thread here about when <script> nodes run (that have been inserted into the DOM) made me think of my experience in class today: Opera, Firefox, Safari all responded to the above minipage without complaint. Chrome accomplished what I thought it should have (with a bit of harmless editorializing: it gave the user the option of turning off the dialoguing; heck my students always have the option of tuning me out, so why would this be any different?). IE on the other hand was most ungracious, to my way of thinking, responding with a null alert box, followed in short order by a "did you notice the information bar" message asking if I would be so bold as to compromise the security of the free world by enabling a possibly malicious script. Then, should I be so bold, and after a few more steps, in which I enable scripted windows, the script is then allowed to run ... alas.... incorrectly. If the same page is run locally rather from a server then IE does not fuss and the world is safe from discrete mathematics.
 
I am pretty confident that IE6 didn't do this sort of thing, so I fear it is one of many of modern browsers' attempts to hobble my quirk-infested ways of teaching subjects using technology when chalk and blackboards might be preferable. Does the spec address this and if so whose browser is handling it correctly?
 
as usual,
David
*The <script> tag and the end script tag are rather like the !JOB and !EOJ cards that we could have used in fortran (and without all the other JCL), but prompt and alert are so much friendlier than read(105,fmt) and write(106, fmt); and besides JavaScript is just plain cooler! 

Received on Wednesday, 21 January 2009 23:20:41 UTC