Javascript Immediate
Following on from Javascript Alert, we take it a step further and have an "immediate" window.
The immediate window system is taken from compiler and RAD tools where they have a debug.print(variable) function which can display the values of variables at various points when running the application inside the IDE.
javascript has precious little in the way of finding out what is the problem might just when your lovingly constructed code doesn't quite do what was expected of it.
Again the alert() method is redefined to suit our purpose
JAVASCRIPT Code :: javascript
Click in the text to select the javascript code
<script type="text/javascript">
var immediate = null;
function alert(message) {
if _
(!immediate) {
immediate = window.open _
("","immed","width=400,height=300");
immediate.moveTo(0,0);
}
immediate.document.write(message _
+ "<br>");
}
</script>
It is pretty simple code, check if an object called immediate exists; If not, create it as a sized window and position it in the top left corner of the screen.
Then you can send message text to the window followed by a line break using the standard alert(message) call.
This article was added by Chris Hirst and was posted on 10 October 2008. Chris has been a member since 09 January 2008 and has written 29 article(s) for modTalk
So long, and thanks for all the fish.
No comments as yet
Be the first to add a comment
Your email will not be shown
Your Name
Comment Title
Comment Text
Page Tags
No Tags to show