|
-
Mar 9th, 2010, 02:03 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Defining a Constant or Variable
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)?
-
Mar 9th, 2010, 02:45 PM
#2
Re: Defining a Constant or Variable
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>
-
Mar 9th, 2010, 03:00 PM
#3
Re: Defining a Constant or Variable
Or you would just use PHP (or another scripting language)...
Code:
<?php
$myVar = 5;
?>
<p><?php echo $myVar;?></p>
...which results in HTML...
-
Mar 9th, 2010, 08:36 PM
#4
Thread Starter
PowerPoster
Re: Defining a Constant or Variable
Thanks to both.
Especially regarding reminder that HTML is "Mark Up Language".
Tend to overlook this fact and expect more than it can deliver.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|