• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

correct format for using if statement in html?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For example:-

The page contains two radio buttons with option_a and option_b.

Now if the user clicks on option_a then I need to display a table, and if user clicks option_b then I need to display another table.

Can anyone please let me know the correct format of writing if/else statement?

Here is my sample code:-

<if ( id == "radioPlatform1")>
<table>
<tr>
<td>
</td>

.....
.....
.....

</tr>
</table>

<else>
<table>
<tr>
<td>

......
.....
.....
</tr>
</table>
</if>


Is there a specific way to write if/else in html?
Also is there any other way that I can use for the problem?

Thanks in advance
[ December 15, 2006: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no if construct in HTML.

In general, if you want to use a conditional you'll either need to do it in client-side Javascript, or in a server-side templating language such as JSP or php.
[ December 15, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can probably solve your particular issue by hiding the tables using CSS, and then using Javascript to cause the appropriate one to be displayed upon the click of the corresponding radio button.
 
reply
    Bookmark Topic Watch Topic
  • New Topic