| Justin Patrin 2004-03-19, 1:29 pm |
| Phpdiscuss - Php Newsgroups And Mailing Lists wrote:
> html file
>
> {* Smarty *}
>
> {literal}
> <script language="javascript">
>
>
> var flag0;
> //alert (flag);
>
> var ce_pun="<tr><td class='style23 style40 style42'> MANAGE PRODUCTS <br>
> <br>help</td></tr>";
>
>
> function vizibilitate()
> {
> var table=document.getElementById('help');
> if (document.hide_form.help_button.value=="Show")
> {
> if (!flag==0)
> {
> if(table.innerHTML!="")
> {
> table.innerHTML="";
> }
>
> else
> {
>
> table.innerHTML=ce_pun;
> }
> document.hide_form.help_button.value="Hide";
> }//if flag
> else
> {
>
> table.innerHTML=ce_pun;
> flag=1;
> document.hide_form.help_button.value="Hide";
> }
> }//if
> else
> {
> document.hide_form.help_button.value="Show";
> table.innerHTML="";
> flag=1;
> }
> }
> </script>
> {/literal}
>
>
> <td valign="bottom">
> <form name="hide_form">
> <input type="button" name="help" value="Help!"
> onClick="java script:vizibilitate()">
> <input type="hidden" name="help_button" value="Show">
> </form>
>
> </td>
>
> <table id="help" width="80%" border="1" cellpadding="6" cellspacing="0"
> bordercolor="#009900" bgcolor="#FFFFCC">
>
>
> </table>
>
>
> -----This works with Mozzila but it doesn't work with InternetExplorer.
> Somebody know why? Please help me!
>
>
>
>
4 things:
1) You should probably replace this syntax:
document.hide_form.help_button.value
with
document.forms["hide_form"].elements["help_button"].value
2) You're saying var flag0; at the top. Perhaps you meant var flag=0;?
3) You have
if (!flag==0) {
Perhaps you mean:
if (flag != 0) {
It shouldn't make a difference, but you never know.
3) To hide something you don't have to change its innerHTML. In fact,
that a very hacky solution. You may want to try using css. For instance:
..hide {
visibility: hidden;
display: none;
height: 0px;
verflow: hidden;
}
Then in your java script:
if (hide) {
table.className = "hide";
} else {
table.className = "";
}
--
paperCrane <Justin Patrin>
|