Skip to content

Instantly share code, notes, and snippets.

@basictomonokai
Last active November 12, 2017 08:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save basictomonokai/dec9f243a76d98c138d9df97087cb6ac to your computer and use it in GitHub Desktop.
入力画面と出力画面があるBASIC!プログラム
console.title "HTML test"
grabfile outhtml1$,"btninp.html",1
grabfile outhtml2$,"btnkka.html",1
outhtml$=outhtml1$
nxttest:
HTML.OPEN
HTML.LOAD.string outhtml$
xnextUserAction:
! loop until data$ is not ""
DO
HTML.GET.DATALINK data$
UNTIL data$ <> ""
type$ = LEFT$(data$, 4)
data$ = MID$(data$,5)
! Act on the data type
! Shown are all the current data types
SW.BEGIN type$
! Back Key hit.
! if we can go back then do it
SW.CASE "BAK:"
PRINT "BACK key: " + data$
popup "終了します",0,0,0
pause 2000
end
SW.BREAK
! A hyperlink was clicked on
SW.CASE "LNK:"
PRINT "Hyperlink selected: "+ data$
popup "リンク先をロード中",0,0,1
! HTML.LOAD.URL data$
browse data$
SW.BREAK
! An error occured
SW.CASE "ERR:"
PRINT "Error: " + data$
popup "エラーが発生しました 終了します",0,0,0
pause 2000
exit
SW.BREAK
! User data returned
SW.CASE "DAT:"
PRINT "User data: " + data$
! Check for Exit
IF data$ = "//x//" then
PRINT "User ended demo."
HTML.CLOSE
popup "終了します",0,0,0
pause 5000
end
else
msx$=data$+"←データの内容"
popup msx$,0,0,0
if left$(data$,5) = "//i//" then
inpx$=mid$(data$,6)
print "入力データ ==> ";inpx$
outhtml$=replace$(outhtml2$,"@@@1@@@",inpx$)
html.close
pause 6000
goto nxttest
endif
pause 1000
goto xnextUserAction
ENDIF
SW.BREAK
! Form data returned.
! Note: Form data returning
! always exits the html.
SW.CASE "FOR:"
PRINT "Form data: "+data$
popup "終了します",0,0,0
pause 2000
exit
SW.BREAK
SW.DEFAULT
PRINT "Unexpected data type:", type$ + data$
popup "終了します",0,0,0
pause 2000
exit
SW.END
GOTO xnextUserAction
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment