update page according selection on a listbox$

All that relates to Javascript, CSS, HTML, ....
Post Reply
TRS80_MKI
Posts: 20
Joined: Sun Apr 18, 2021 3:38 pm
Has thanked: 9 times
Been thanked: 5 times

update page according selection on a listbox$

Post by TRS80_MKI »

Hi nice people,


Instead using TAB .. i'm a new old TRex .. JS is not my cup of tea ..
i want update the HTML page acording the selection on a listbox$.
But doesn't work ...
Any idea ..
this is a demo code :

@+
TRS80_MKI


g_a$=""
g_a0$ = ""
g_a1$=""
g_a2$=""
g_a3$=""

b$=""
action$ = ""
act1$="Scan"
act2$="Calibration"
act3$="Camera"

init_scan g_a1$
init_calibration g_a2$
init_camera g_a3$
init_header g_a0$
g_a$= g_a0$

cls
html g_a$

onHtmlReload setpage0
onHtmlChange paramchange
autorefresh 1000
wait

setpage0:
cls
html g_a$
return

paramchange:
b$ = HtmlEventVar$
select case b$
case act1$: 'Scan
g_a$= g_a0$ + g_a1$
case act2$: 'Calibration
g_a$= g_a0$ + g_a2$
case act3$: 'Camera
wlog action$
g_a$= g_a0$ + g_a3$
case else:
end select
return

'-----------------------------------------------------
' WEB Page Button main header
'-----------------------------------------------------
sub init_header(g_a0$)
g_a0$=""
g_a0$ = g_a0$ + CSSID$("lbox", "width:300px; font-size:50px; ")
g_a0$ =g_a0$ + listbox$(action$,"Scan,Calibration,Camera","lbox") + "<br> <br>"
end sub

'-----------------------------------------------------
' WEB Page Scan
'-----------------------------------------------------
sub init_scan(g_a1$)
g_a1$ = ""
g_a1$ = g_a1$ + "<h2>" + act1$ + "</h2>"
end sub

'-----------------------------------------------------
' WEB Page Calibration
'-----------------------------------------------------
sub init_calibration(g_a2$)
g_a2$ = ""
g_a2$ = g_a2$ + "<h2>" + act2$ + "</h2>"'font-size:2.8em
end sub

'-----------------------------------------------------
' WEB Page Config. Camera
'-----------------------------------------------------
sub init_camera(g_a3$)
g_a3$ = ""
g_a3$ = g_a3$ + "<h2>" + act3$ + "</h2>"
end sub
User avatar
cicciocb
Site Admin
Posts: 2626
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 549 times
Been thanked: 1861 times
Contact:

Re: update page according selection on a listbox$

Post by cicciocb »

try this :

Code: [Local Link Removed for Guests]

g_a$=""
g_a0$ = ""
g_a1$=""
g_a2$=""
g_a3$=""

b$=""
action$ = ""
act1$="Scan"
act2$="Calibration"
act3$="Camera"

init_scan g_a1$
init_calibration g_a2$
init_camera g_a3$
init_header g_a0$
g_a$= g_a0$

cls
html g_a$

onHtmlReload setpage0
onHtmlChange paramchange
autorefresh 1000
wait

setpage0:
cls
html g_a$
return

paramchange:
if HtmlEventVar$ = "action$" then
  b$ = action$
  select case b$
    case act1$: 'Scan
      g_a$= g_a0$ + g_a1$
    case act2$: 'Calibration
      g_a$= g_a0$ + g_a2$
    case act3$: 'Camera
      wlog action$
      g_a$= g_a0$ + g_a3$
    case else:
  end select
  cls
  html g_a$
end if
return

'-----------------------------------------------------
' WEB Page Button main header
'-----------------------------------------------------
sub init_header(g_a0$)
  g_a0$=""
  g_a0$ = g_a0$ + CSSID$("lbox", "width:300px; font-size:50px; ")
  g_a0$ =g_a0$ + listbox$(action$,"Scan,Calibration,Camera","lbox") + "<br> <br>"
end sub

'-----------------------------------------------------
' WEB Page Scan
'-----------------------------------------------------
sub init_scan(g_a1$)
  g_a1$ = ""
  g_a1$ = g_a1$ + "<h2>" + act1$ + "</h2>"
end sub

'-----------------------------------------------------
' WEB Page Calibration
'-----------------------------------------------------
sub init_calibration(g_a2$)
  g_a2$ = ""
  g_a2$ = g_a2$ + "<h2>" + act2$ + "</h2>"'font-size:2.8em
end sub

'-----------------------------------------------------
' WEB Page Config. Camera
'-----------------------------------------------------
sub init_camera(g_a3$)
  g_a3$ = ""
  g_a3$ = g_a3$ + "<h2>" + act3$ + "</h2>"
end sub
TRS80_MKI
Posts: 20
Joined: Sun Apr 18, 2021 3:38 pm
Has thanked: 9 times
Been thanked: 5 times

Re: update page according selection on a listbox$

Post by TRS80_MKI »

Hi cicciocb ,

i forget this :: if HtmlEventVar$ = "action$" then
for an old man like me , making an error as a little boy ... :oops:

thanks for the help
@+
TRS80_MKI
Post Reply