Continuing, I edited/added the following code to test2.ijs and ran and
saved the code while in JHS.
HBS=: 0 : 0
jhh1 'hello world'
'<canvas id="myCanvas" width="500" height="500"> </canvas>'
)
JS=: 0 : 0 NB. javascript
// function ev_roll_click(){jsubmit();} // submit form - calls J
ev_roll_click
var canvas = $("#myCanvas");
var context = canvas.get(0).getContext("2d");
context.fillRect(40, 40, 100, 100);
)
But I see no change in the `hello` tab even after a refresh. My only
response in the jijx window was the following.
|value error: jev_get_test2_
| jev_get_test2_''
*** response not sent for test2
*** html409 Conflict
I continued trying to get more info in the jijx window as shown below (the
vast majority below is the result of entering ` LASTRESPONSE_test2_` .
But I do not have a clue what to try next. Help, please.
**********longish session in jijx below*********
names_test2_ ''
CSS HBS JS LASTRESPONSE create jev_get
JS_test2_
// function ev_roll_click(){jsubmit();} // submit form - calls J ev_roll_click
var canvas = $("#myCanvas");
var context = canvas.get(0).getContext("2d");
context.fillRect(40, 40, 100, 100);
LASTRESPONSE_test2_
...
return 1;
}
// focus if hml/jmab - return 1 if focus is done
function jmenunavfocus(m,n)
{
if(2!=jmenunavinfo(m,n))return 0;
m[n].focus();
return 1;
}
// return m[n] info - 0 none, 1 hmg, 2 hml or hmab
function jmenunavinfo(m,n)
{
if(n==m.length)return 0;
return ("jhmg"==m[n].getAttribute("class"))?1:2
}
// activate menu group n
function jactivatemenu(n)
{
jmenuhide();
var node= jfindmenu(n);
if('undefined'==typeof node) return;
node.focus();
}
var menublock= null; // menu ul element with display:block
var menulast= null; // menu ul element just hidden
function jmenuclick(ev)
{
jmenuhide(ev);
var e=window.event||ev;
var tar=(typeof e.target=='undefined')?e.srcElement:e.target;
var id=tar.id;
var idul= id+"_ul";
jbyid(id).focus(); // required on mac
if(jbyid(idul).style.display=="block")
{
menublock= null;
jbyid(idul).style.display= "none";
}
else
{
if(menulast!=jbyid(idul))
{
menublock= jbyid(idul);
menublock.style.display= "block";
}
}
}
function jmenushow(node)
{
jmenuhide();
var id=node.id;
var idul= id+"_ul";
menublock= jbyid(idul);
menublock.style.display= "block";
}
function jmenuhide()
{
if(tmenuid!=0) clearTimeout(tmenuid);
tmenuid= 0;
menulast= menublock;
if(menublock!=null) menublock.style.display= "none";
menublock= null;
return true;
}
// browser differences
// safari/chrome onblur on mousedown and onfocus on mouseup
// onblur will hide the menu 250 after mousedown (no clear)
// so menu item click needs to be quick
var tmenuid= 0;
function jmenublur(ev)
{
if(tmenuid!=0) clearTimeout(tmenuid);
tmenuid= setTimeout(jmenuhide,500)
return true;
}
function jmenufocus(ev)
{
if(tmenuid!=0) clearTimeout(tmenuid);
tmenuid= 0;
return true;
}
function jmenukeydown(ev)
{
var e=window.event||ev;
var c=e.keyCode;
return(c>36&&c<41)?false:true;
}
function jmenukeypress(ev)
{
var e=window.event||ev;
var c=e.keyCode;
return(c>36&&c<41)?false:true;
}
function jmenukeyup(ev)
{
var e=window.event||ev;
var c=e.keyCode;
if(c<37||c>40)return false;
var tar=(typeof e.target=='undefined')?e.srcElement:e.target;
jmenunav(tar,c);
return true;
}
// get pixel... - sizing/resizing
// window.onresize= resize; // required for resize
// and resize should be called in ev_body_load
// the ...h functions need simple changes to
// become the corresponding set of w functions
// body{background:aqua} can be useful in
// finding out why calculations turn out wrong
// IF and FF both have bugs with <h1>...</h1>
// vs these calculations and <hx> should not
// be used where resizing will be used
// get pixel window height
function jgpwindowh()
{
if(window.innerHeight)
return window.innerHeight; // not IE
else
return document.documentElement.clientHeight;
}
// get pixel body margin height (top+bottom)
function jgpbodymh()
{
var h;
if(window.getComputedStyle)
{
h= parseInt(window.getComputedStyle(document.body,null).marginTop);
h+= parseInt(window.getComputedStyle(document.body,null).marginBottom);
}
else
{
h= parseInt(document.body.currentStyle.marginTop);
h+= parseInt(document.body.currentStyle.marginBottom);
}
return h;
}
// get pixel div height - IE/FF bugs vs <h1>
function jgpdivh(id){return jbyid(id).offsetHeight;}
/*
function jgpdivh(id)
{
var e=jbyid(id);
if(e==null)return 50;
//alert(e+" "+id);
// alert(e.offsetHeight);
//return jbyid(id).offsetHeight;
var v=e.offsetHeight;
//alert(id+" "+v);
return v;
}
*/
// get pixel end
// debug
// numbers from unicode
function debcodes(t)
{
r= "";
for(var i=0;i<t.length;++i)
r= r+" "+t.charCodeAt(i);
return r;
}
// eval js sentences in s
// a is true in ajax and false in refresh
function jseval(ajax,s)
{
var i,j,a,z,q;
a= "<!-- j html output a --><!-- j js a --><!-- ";
z= " --><!-- j js z --><!-- j html output z -->";
while(0!=s.length)
{
i= s.indexOf(a);
if(-1!=i)
{
i+= a.length;
j= s.indexOf(z);
q= s.substring(i,j);
if(ajax||';'==q.charAt(0))
try{eval(q);}catch(e){alert(e+"\n"+q);}
s= s.substring(j+z.length);
}
else
s= "";
}
}
// function ev_roll_click(){jsubmit();} // submit form - calls J ev_roll_click
var canvas = $("#myCanvas");
var context = canvas.get(0).getContext("2d");
context.fillRect(40, 40, 100, 100);
</script>
</head>
<body onload="jevload();" onunload="jevunload();"
onfocus="jevfocus();"><form id="j" name="j" method="post"
action="test2"><input type="hidden" name="jdo" value=""><input
type="hidden" name="jlocale" value="test2"><input type="hidden"
name="jid" va...
</html>
**********longish session in jijx above*********
On Sat, Sep 14, 2013 at 6:49 AM, Brian Schott <[email protected]>wrote:
> Instead of using gtk I used unix's console and entered `nano test2.ijs`
> as shown next. What is not shown is that I merely copied your text for
> `test2.ijs` directly into nano.
>
> server:~ brian$ cd /Users/brian/j64-701-user
> server:j64-701-user brian$ nano test2.ijs
>
> What seemed to fail, was the following line, but it was not a failure,
> just a misplaced command.
>
> http://127.0.0.1:65001/test2
>
> Instead of being entered in the unix console, the command needed to be
> entered in the browser as a URL, and only after entering the following in
> the browser as a URL.
>
> http://127.0.0.1:65001/jijs?mid=open&path=~User/test2.ijs#
>
> An alternative to entering the above line in the URL field of the browser
> is to select `jfile` from the leftmost menu of the jijx window of JHS and
> then (double-?) clicking on the file `test2.ijs` on that page.
>
> But the key step then is to `run` the selected file using the `action`
> menu or as a keystroke shortcut entering Esc-r.
>
> Then, opening a new tab in the browser and entering the link below (and
> above), produces the Hello World web page, with the tab titled `hello` . My
> browser even produces the blue J.
>
> http://127.0.0.1:65001/test2
>
> Yes! Thank you Bjorn.
>
> Next I will attempt to produce a canvas rendered rectangle.
>
>
>
>
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm