Is it possible to define a constant or variable at the front end of html
that can be used throughout the rest of the program?
Is so how (to define) and where would it go (be placed)?
Printable View
Is it possible to define a constant or variable at the front end of html
that can be used throughout the rest of the program?
Is so how (to define) and where would it go (be placed)?
HTML is not a programming language (thus you cannot consider it a "program") -- it's a mark-up language. you can't have variables in HTML. you would need to accomplish this in JavaScript (assuming you really want to use the front end/client to define the variable), in which case a variable is defined with the var keyword:
Code:<script language="javascript">
var myVar = 5;
</script>
Or you would just use PHP (or another scripting language)...
...which results in HTML...Code:<?php
$myVar = 5;
?>
<p><?php echo $myVar;?></p>
Code:<p>5</p>
Thanks to both.
Especially regarding reminder that HTML is "Mark Up Language".
Tend to overlook this fact and expect more than it can deliver.