I have a small web page on my embedded device with such code:
<th width="310"
DHCP Relay:
</th>
<td> </td>
<td>
<% nvram_get("rg_dhcp_relay_enable""); %>
</td>
where ‘nvram_get’ returns either 1 or 0.I have two questions in this connection:
(1) I’d like to print “ON” or “OFF” instead of 1 or 0 respectively. Is it possible to do in <%…%> something like “if .. then ..” or there is another way?
(2) This code works fine whenever I reload page. Also on this page I have select list, and I’d like the above text to be changed accordingly to item selected from list.
So I decided to write a JavaScript function and hook it on ‘onChange’ event. Sounds reasonable? I only don’t know how to modify the text within .. from JS function.
Anyh ideas?
Thanks!
1: It should be possible but you don’t say what language, so I can’t tell you the syntax to use. For Java (JSPs), it would be:
2: Again not much information to help you. Your approach sounds reasonable, depending on how the page works. Some of them submit the form when you select a new value from a list.