| View previous topic :: View next topic |
| Author |
Message |
boylesg
Joined: 25 Apr 2008 Posts: 5
|
Posted: Mon Apr 28, 2008 2:16 pm Post subject: html and variables |
|
|
Don't know whether any one else has thought of this but I will share anyway....
I have a series of tables on different pages containing plant items. All the table cells are identical except for their contents.
Woundn't it be great if you could just define a table of variables containing the values you want to insert into each cell. Then you would just have to edit the variables in one place rather than scrolling through the table code or mucking around in Frontpage or what ever.
Nice idea except you can only use variables as paramaters to calls to javascript functions but you can't use them as paramters to html tags.
However I figured out that the bits of html code, where I wished to use my variables as parameters to html tags I could simply write into the page via java script. Here is an example:
A bit messy but it sure makes creating new pages and changing contents so much easier.
<tr>
<script language="javascript">
document.write("<td align=\"center\"><font face=\"Arial\" size=\"2\"><img border=\"0\" src=" + AWP14Photo + " width=\"210\" height=\"212\"></font></td>");
document.write("<td align=\"center\"><i><font face=\"Arial\" size=\"2\">" + AWP14SpeciesName + "</font></i></td>");
document.write("<td align=\"center\"><font face=\"Arial\" size=\"2\">" + AWP14CommonName + "</font></td>");
document.write("<td align=\"center\"><font size=\"2\" face=\"Arial\">" + AWP14Status + "</font></td>");
document.write("<td align=\"center\"><font face=\"Arial\" size=\"2\">" + AWP14Size + "</font></td>");
document.write("<td align=\"center\"><font face=\"Arial\" size=\"2\">" + '$' + AWP14Price + "</font></td>");
</script>
<td align="center"><font face="Arial" size="2"><input name=addbox type=button value=" Add to cart " onclick=Loc_additem("AWP014",AWP14Price,AWP14Desc,ThisPage)></font>
<p><font face="Arial" size="2">
<input type=button name=subbox value="Subtract from cart" onclick=Loc_subitem("AWP014",AWP14Price,AWP14Desc,ThisPage)></font>
</p>
<p><font face="Arial" size="2">Quantity: <input type=text name=AWP014 size=2></font></p>
<p><font face="Arial" size="2">
<applet code="fphover.class" codebase="./" width="38" height="38">
<param name="textcolor" value="#FFFFFF">
<param name="text" value=" ">
<param name="color" value="#FFFFFF">
<param name="hovercolor" value="#000000">
<param name="effect" value="reverseGlow">
<param name="bgcolor" value="#FFFFFF">
<param name="url" valuetype="ref" value="javascript:parent.updatemain_order()">
<param name="image" valuetype="ref" value="images/cart_go.png">
</applet>
</font></p>
</td>
</tr> |
|
| Back to top |
|
 |
|
|
rangana 250+ Club

Joined: 27 Feb 2008 Posts: 439 Location: Cebu City Philippines
|
Posted: Tue Apr 29, 2008 1:18 am Post subject: Re: html and variables |
|
|
Document.write is deprecated...you could change it to innerHTML  |
|
| Back to top |
|
 |
boylesg
Joined: 25 Apr 2008 Posts: 5
|
Posted: Tue Apr 29, 2008 1:29 am Post subject: Re: html and variables |
|
|
| rangana wrote: |
Document.write is deprecated...you could change it to innerHTML  |
Why do you say that document.write is inadvisable? |
|
| Back to top |
|
 |
rangana 250+ Club

Joined: 27 Feb 2008 Posts: 439 Location: Cebu City Philippines
|
|
| Back to top |
|
 |
dflynn 500+ Club

Joined: 03 Oct 2007 Posts: 505 Location: Guelph, Canada
|
Posted: Tue Apr 29, 2008 2:57 am Post subject: Re: html and variables |
|
|
| I don't get the purpose of this... isn't it essentially just css in a rather confusing manner? |
|
| Back to top |
|
 |
boylesg
Joined: 25 Apr 2008 Posts: 5
|
Posted: Tue Apr 29, 2008 8:03 am Post subject: Re: html and variables |
|
|
| dflynn wrote: |
| I don't get the purpose of this... isn't it essentially just css in a rather confusing manner? |
If you add the following to the code above does it help you understand what I was trying to acheive? It means that the create new table rows all I have to copy the last row and past it at the bottom, changing the "AWP1" part of the vairbale names to the next consecutive number and then add those variables at the top of the file along with the rest.
What is CSS by the way?
TubePrice = "3.50"
PotPrice = "9.00"
ThisPage = "AquaticWetlandHerbs.html"
AWP1Desc = "Alisima_plantago-aquatica"
AWP1Photo = "http://i209.photobucket.com/albums/bb196/boylesg/AquaticWetland/plantago-aquatica-1.jpg"
AWP1SpeciesName = "Alisima plantago-aquatica"
AWP1CommonName = "Water Plantain"
AWP1Status = "Local native"
AWP1Size = "Tube"
AWP1Price = TubePrice
AWP2Desc = "Cotula_coronopifolia"
AWP2Photo = "http://i209.photobucket.com/albums/bb196/boylesg/AquaticWetland/coronopifolia-flowers.jpg"
AWP2SpeciesName = "Cotula coronopifolia"
AWP2CommonName = "Creeping Crotula"
AWP2Status = "Local native"
AWP2Size = "Tube"
AWP2Price = TubePrice
AWP3Desc = "Hydrocotyl_verticillata"
AWP3Photo = "http://i209.photobucket.com/albums/bb196/boylesg/AquaticWetland/verticillata.jpg"
AWP3SpeciesName = "Hydrocotyl verticillata"
AWP3CommonName = "Shield Pennywort"
AWP3Status = "Local native"
AWP3Size = "Tube"
AWP3Price = TubePrice
AWP4Desc = "Lobelia_pratiodies"
AWP4Photo = "http://i209.photobucket.com/albums/bb196/boylesg/AquaticWetland/pratioides-plant.jpg"
AWP4SpeciesName = "Lobelia pratiodies"
AWP4CommonName = "Poison Lobelia"
AWP4Status = "Local native"
AWP4Size = "Tube"
AWP4Price = TubePrice |
|
| Back to top |
|
 |
rangana 250+ Club

Joined: 27 Feb 2008 Posts: 439 Location: Cebu City Philippines
|
Posted: Tue Apr 29, 2008 11:01 am Post subject: Re: html and variables |
|
|
| boylesg wrote: |
What is CSS by the way?
|
CSS lets you control the style and layout of your pages
Give it a google and you'll find better explanation. I'll recommend this:
CSS http://www.w3schools.com/Css/default.asp |
|
| Back to top |
|
 |
boylesg
Joined: 25 Apr 2008 Posts: 5
|
Posted: Tue Apr 29, 2008 11:26 am Post subject: Re: html and variables |
|
|
| rangana wrote: |
| boylesg wrote: |
What is CSS by the way?
|
CSS lets you control the style and layout of your pages
Give it a google and you'll find better explanation. I'll recommend this:
CSS http://www.w3schools.com/Css/default.asp |
Is it meant to be an alternative to html or a script of sorts like javascript? |
|
| Back to top |
|
 |
dflynn 500+ Club

Joined: 03 Oct 2007 Posts: 505 Location: Guelph, Canada
|
Posted: Tue Apr 29, 2008 11:36 am Post subject: Re: html and variables |
|
|
It doesn't replace HTML completely, instead it replaces the parts that clutter HTML coding such as styling the page. so <Font> tags, and styles withing <body> tags etc.
It's not like Javascript, but I guess similar in the sense that it relies on HTML to exist, because without HTML the others are practically useless. |
|
| Back to top |
|
 |
rangana 250+ Club

Joined: 27 Feb 2008 Posts: 439 Location: Cebu City Philippines
|
Posted: Wed Apr 30, 2008 1:22 am Post subject: Re: html and variables |
|
|
CSS is different from HTML and is different from javascripts
If I were to describe, web designing is like a house..HTML is your framework, your house's skeleton.
CSS paints the house, gives color and peculiar beauty
Javascripts is your house's electricity, it powers your house...you could always live without electricity, but when there is one, your house will be lively
Flash is like a big tv in the middle of the house...it adds to the house's liveliness.
Hope makes sense  |
|
| Back to top |
|
 |
|