以下是我来自 smarty 模板的代码片段。
<input type="radio" name="newsletter_call_to_action_status" value="1" checked='checked' onclick="select_option(this.value);" {if $data.newsletter_call_to_action_status=='1' } checked {/if}>Yes
<input type="radio" name="newsletter_call_to_action_status" value="0" onclick="select_option(this.value);" {if $data.newsletter_call_to_action_status=='0' } checked {/if}>No
<tr id="action_link_no" {if $data.newsletter_call_to_action_status=='1' }style="display:;" {else}style="display:none;" {/if}>
<td colspan="2"> </td>
</tr>
<tr class="action_link_yes" height="30">
<td align="right" width="300">
<label><b>{'Enter call to action text'|signal_on_error:$error_msg:'newsletter_call_to_action_text'}</b> <strong style="color:red">*</strong>
</label>
</td>
<td>
<input type="text" name="newsletter_call_to_action_text" id="newsletter_call_to_action_text" value="{$data.newsletter_call_to_action_text}" maxlength="50" class="inputfield">
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr class="action_link_yes" height="30">
<td align="right" width="300">
<label><b>{'Enter call to action link'|signal_on_error:$error_msg:' newsletter_call_to_action_link'}</b> <strong style="color:red">*</strong>
</label>
</td>
<td>
<input type="text" name="newsletter_call_to_action_link" id="newsletter_call_to_action_link" value="{$data.newsletter_call_to_action_link}" class="inputfield">
</td>
</tr>
现在,在表单加载时,如果newsletter_call_to_action_status == 1
它应该显示tr
with ,并在值为 时class=action_link_yes
隐藏tr
using 。class=action_link_no
0
我怎样才能做到这一点?