- Dav
Code: Select all
'Simple javascript tester
'Uses Browser to enter javascript
'Shows how to make browser editable
'Coded by Dav, FEB/2015
'set screen
set output font color 1,1,1
set output back color 0,0,0
print "Javascript tester";
'allow browser window to zoom in/out
set browsers scaled
'open browser window
browser "js" url "" at 0,40 size screen_width(),screen_height() -40
'javascript call to make browser editable
u$ = browser_text$("js", "document.body.contentEditable='true';document.designMode='on';void 0")
'make some buttons
button "run" text "Run" at 235,4
button "quit" text "X" at 295,4
'shortcut
q$ =chr$(34)
'write sample code to browser
s$="document.write("&q$&"alert('This a sample')"&q$&")"
u$=browser_text$("js",s$)
'main loop...
do
if button_pressed("run") then
'get browser contents
u$=browser_text$("js", "document.body.textContent")
'send it back (run it...)
u2$=browser_text$("js", u$)
end if
until button_pressed("quit")
end