Brian,

Your script was very close to correct. I am not sure of exactly the problem
you saw.

I have tested the following in both 807 and 902 with firefox on linux. I
think it should work on your platform.

The parens in the first HBS line are not necessary and I removed them.

The line in your script:
create SCORE
causes  confusion as it send the app html to be sent to the browser. This
is not what you want. I removed that line.

Run the script to populate the rps locale. But nothing is run so you don't
see funny stuff in the browser! And then get the page in your browser by
browsing to url localhost:65001/rps and then you should see your app and
with luch the buttons will work.

I also added the missing ev_rollBrian_click line.

*** rps.ijs
coclass'rps'
coinsert'jhs'

HBS=: 0 : 0
jhh1'Rock Paper Scissors'
'rollJoan'   jhb'Joan'
text
'rollBrian'   jhb'Brian'
)

SCORE=: 0

text=: 0 : 0
<span id="score" class="mark"><RESULT></span>
)
create=: 3 : 0
'rps'jhr'RESULT';y NB. <RESULT> tag replaced by y
)
jev_get=: create

ev_rollJoan_click=: 3 : 'create |SCORE =: SCORE - 1'
ev_rollBrian_click=: 3 : 'create |SCORE =: SCORE + 1'

CSS=: 0 :0
span.mark{color:green;}
)

JS=: 0 : 0 NB. javascript
function ev_rollJoan_click(){jsubmit();}
function ev_rollBrian_click(){jsubmit();}
)

On Sat, Dec 5, 2020 at 7:13 PM Brian Schott <schott.br...@gmail.com> wrote:

> My jhs app, which is patterned after demo1,
> produces the following Alert when launched.
>
> SyntaxError: invalid or unexpected token
> '';
> z= ''
>
> (Either of those ''s could be "s, I can't tell).
>
> But when I click on the OK button I see an h1 title on one line
> and then on the next line I see a button named Joan, a 0, and a button
> named Brian
>
> When I click on either button I get one of the following Alerts.
>
> not defined function ev_rollJoan_click()
> not defined function ev_rollBrian_click()
>
>
> Attached is the script.
> Any ideas?
>
> --
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to