LoginLogin

HTMLBASIC

Root / Submissions / [.]

triangleCreated:
Download:D3EQ43R4
Version:Size:28.4 KB
A primitive version of HTML and CSS for SmileBASIC using user-defined functions.

Instructions:

'---------
'HTMLBASIC
'---------
'I WANTED TO MAKE AN HTML THING IN SMILEBASIC
'IT'S A BIT DIFFERENT FROM NORMAL HTML
'AND VERY PRIMITIVE
'UDFs CAN'T HAVE ANGLE BRACKETS
'TO USE, TYPE THIS INTO YOUR PROGRAM:

'SYSBEEP=0
'LOAD"PRG1:HTMLBASIC",FALSE
'USE 1
'EXEC 1
'SYSBEEP=1

'TAGS AVAILABLE:

'HTML
'STARTS THE DOCUMENT

'EHTML
'ENDS THE DOCUMENT

'HEAD
'STARTS THE HEAD

'EHEAD
'ENDS THE HEAD

'TITLE STRING$
'GIVES THE DOCUMENT A TITLE ON THE TOP SCREEN
'CAN ONLY BE USED IN THE HEAD

'BODY
'STARTS THE BODY

'EBODY
'ENDS THE BODY
'DOESN'T ACTUALLY DO ANYTHING REALLY

'P STRING$
'PARAGRAPH ELEMENT

'IINPUT LENGTH
'TEXT BOX
'COULDN'T USE "INPUT" BECAUSE THAT'S ALREADY A COMMAND
'LENGTH IS THE MAX LENGTH OF THE STRING IN THE TEXT BOX

'STYLE STRING$
'ADDS CSS TO THE PREVIOUSLY DEFINED ELEMENT


'CSS:
'JUST LIKE NORMAL CSS BUT LIMITED NUMBER
'OF ATTRIBUTES AVAILABLE AND A BIT STRICT
'IN THE ORDER OF ATTRIBUTES

'WIDTH
'ALTERS THE WIDTH OF THE ELEMENT
'NUMBER IS IN TEXT SPACES, SO 1=8PX
'CAN ONLY INCREASE THE WIDTH

'HEIGHT
'ALTERS THE HEIGHT OF THE ELEMENT
'NUMBER IS IN TEXT SPACES, SO 1=8PX
'CAN ONLY INCREASE THE HEIGHT

'ALIGN
'ALIGNS THE ELEMENT
'CAN BE EITHER LEFT,RIGHT, OR CENTER
'IF LEFT OUT, THE ELEMENT WILL BE LEFT-ALIGNED
'MUST BE AFTER WIDTH AND HEIGHT

'COLOR
'CHANGES THE TEXT COLOR
'0-15
'YOU CAN ALSO USE THE TEXT COLOR CONSTANTS
'LIKE #TBLACK

'BACKGROUND-COLOR
'SETS THE BACKGROUND COLOR OF THE EELEMENT
'MUST BE AFTER WIDTH, HEIGHT, AND ALIGN
'FORMATS:
'#FFFFFF
'>6-DIGIT HEX VALUE AFTER #
'#FFF
'>3-DIGIT HEX VALUE AFTER #
'RGB(255,255,255)
'>SAME AS SMILEBASIC
'YOU CAN ALSO USE THE COLOR CONSTANTS
'LIKE #BLACK

'BORDER-COLOR
'SETS THE COLOR OF THE BORDER
'MUST BE AFTER WIDTH, HEIGHT, AND ALIGN
'SAME FORMATS AS BACKGROUND-COLOR

'BORDER-TOP
'BORDER-BOTTOM
'BORDER-LEFT
'BORDER-RIGHT
'SETS THE COLOR OF A SIDE OF THE BORDER
'MUST BE AFTER WIDTH, HEIGHT, AND ALIGN
'SAME FORMATS AS BACKGROUND-COLOR

'ONCLICK
'FUNCTION TO EXECUTE WHEN ELEMENT IS CLICKED
'THE FUNCTION CAN'T HAVE ANY PARAMETERS

'ONLOAD
'FUNCTION TO EXECUTE WHEN PAGE IS DONE LOADING
'THE FUNCTION CAN'T HAVE ANY PARAMETERS


'JAVASCRIPTY FUNCTIONS
'MEANT TO JUST BE SUPPLEMENTS TO BASIC FOR
'INTERFACING WITH HTMLBASIC

'LINK LABELNAME$
'GOES TO THE SPECIFIED LABEL
'MUST HAVE THE SLOT NUMBER OF THE LABEL, LIKE
'LINK "0:@LABEL"
'IF SLOT NUMBER IS LEFT OUT,
'SLOT 0 IS ASSUMED

'CONSOLELOG STRING$
'WRITES TO THE CONSOLE
'THE CONSOLE IS ON THE TOP SCREEN

'CONSOLECLEAR
'CLEARS THE CONSOLE

Cool.

Wow, it looks like you took my idea and put it to action. Nice job!

Centering would be a good idea. For the math, do something like XLOC%=(25-(LEN(STRING$)/2))

Replying to:MasterR3C0RD
Centering would be a good idea. For the math, do something like XLOC%=(25-(LEN(STRING$)/2))
Oh, and for JavaScript, you could use a few commands like console.log("Hello, world!") is PRINT "Hello, world!"

Replying to:MasterR3C0RD
Centering would be a good idea. For the math, do something like XLOC%=(25-(LEN(STRING$)/2))
I'll add it to the list.

Petitworld includes something similar: PTML

Replying to:Ptcguy
Petitworld includes something similar: PTML
Yeah, I saw that. It looked pretty interesting.