HTML

From Liberty BASIC Family
Jump to navigation Jump to search
Not supported in Just BASIC Not supported in Liberty BASIC Not supported in Liberty BASIC 5 Supported in Run BASIC

Description

Carl Gundel has this to say about using HTML in Run BASIC:
Right now there are two important things to know about HTML and Run BASIC:
If you use a PRINT statement, all HTML gets escaped. So in other words if you use:
PRINT "a <b>bold</b> word"
You will see the tags in the output and bold will not be bold.
If you want the tags to work, use the HTML statement, like this:
HTML "a <b>bold</b> word"
It's just like a PRINT statement, but the tags work. :)
-Carl

Syntax

  1. HTML "any text"
  2. HTML String$

Hints

Structure

You can break out of the fixed-width font "console" appearance of text-based displays by forcing the DIV for the display to close, allowing you to use the full range of HTML font and text display capabilities. Put this at the top of your code script:
html "</div><div>"

Text Attributes

Basic HTML tags for bold, italic, underline, centered text, etc. allow you to format text output.
html "<b>This is bold.</b>"
html "<i>This is italic.</i>"
html "<u>This is underlined.</u>"
html "<center>This is centered.</center>"

Formatting the HTML Statement

The HTML script above can be accomplished with a single HTML statement. The HTML is started with an opening quotation mark. New lines become part of the HTML statement, which continues until a closing quotation mark is reached. Here is the code above, formatted into a single HTML statement.
html "<b> This is bold.</b>
<i>This is italic.</i>
<u>This is underlined.</u>
<center>This is centered.</center>"

Fonts

The tag is deprecated, but it can still be used. Here are some examples. Size values must be in the range 1-7.
html "<font size=5>This is large.</font>"
html "<font color = red>This is red.</font>"
html "<font color=#FF0000>This is also red.</font>"
html "<font face=courier>This is courier.</font>"
html "<font face=verdana>This is verdana.</font>"
html "<font face=times>This is times.</font>"

Links

To link to another website, use the anchor tag. Quotation marks around the URL appear to be optional.
With embedded quotation marks:
html "<a href=""http://libertybasic.com"">Liberty BASIC Home Page</a>"
Open in a new browser window:
html "<a href=""http://libertybasic.com"" target=_blank>Liberty BASIC Home Page</a>"
Open in an inset frame, with alignment attributes:
html "<IFRAME SRC=""http://libertybasic.com/"" WIDTH=600 HEIGHT=400 ALIGN=CENTER>"

Example

' Place a simple, working example of the keyword here

Useful Procedures

' Place a useful function or sub using this keyword here