Link to home
Start Free TrialLog in
Avatar of weversbv
weversbv

asked on

hide - visible SELECT tag

I have the following code:

<HTML>
<HEAD>
<TITLE>Test</TITLE>

<SCRIPT language=JavaScript>
<!--
function validateNumber(e) {
      var nCharcode = (window.event) ? window.event.keyCode : e.which;
      if((nCharcode >= 48 && nCharcode <= 57) || nCharcode ==44 || nCharcode ==46 || nCharcode == 13 || nCharcode == 8 || nCharcode == 0) {
            return (e);
      }
      else {
            alert("Alleen cijfers, punt of komma zijn toegestaan!");
            return (false);
      }
}

function sh(name, visstr) {
      Obj = (navigator.appName=='Netscape') ? document.layers[name] : document.all[name].style
      if (visstr=="hidden")
            Obj.position="absolute"
      else {
            Obj.position="relative";
            Obj.height=objheight;
      }
      Obj.visibility = visstr;
}

function get_height() {
      Obj=((navigator.appName=="Netscape") ? document.layers['myId'] : document.all['myId']);
      objheight=Obj.offsetHeight;
      sh("myId", "hidden");
      Obj=((navigator.appName=="Netscape") ? document.layers['myId1'] : document.all['myId1']);
      objheight=Obj.offsetHeight;
      sh("myId1", "hidden");
}

function ch(obj) {
      f_Obj = obj.form;
      var bh=(f_Obj['view_correction'].checked||f_Obj['update_correction'].checked)?1:0;
      if (bh)
            sh('myId', 'visible');
      else
              sh('myId', 'hidden');
}

function ch1(obj) {
      f_Obj = obj.form;
      if (f_Obj['view_currency_value'].checked) {
            sh('myId1', 'visible');
            document.Form.currency_value.disabled = false;
            document.Form.view_correction.disabled = true;
            document.Form.update_correction.disabled = true;                  
            document.Form.correction.disabled = true;
            document.Form.margin_fixed.disabled = true;
            document.Form.correction.value = document.Form.correction_old.value;                               
            document.Form.currency_value.value = document.Form.currency_value_old.value;      
      }
      else {
            sh('myId1', 'hidden');
            document.Form.currency_value.disabled = true;
            document.Form.view_correction.disabled = false;
            document.Form.update_correction.disabled = false;
            document.Form.correction.disabled = false;
            document.Form.margin_fixed.disabled = false;
            document.Form.currency_value.value = '';                        
      }
}
window.onload=get_height
//-->
</SCRIPT>

</HEAD>
<BODY>

<FORM name=Form method=post>
<INPUT type=hidden value=update_currency name=action>
<INPUT type=hidden value=1 name=number>
<INPUT type=hidden value=USD name=code>
<INPUT type=hidden value="Zaterdag, 18 Augustus 09:17:30 2001" name=update_time>
<TABLE width="100%" border=1>
<TR>
<TH align=right colSpan=2>
Informatie Valuta US Dollar
</TH>
</TR>
<TR>
<TH vAlign=top align=left width=200>
Valuta*:
</TH>
<TD>
<INPUT type=hidden value="US Dollar" name=currency>
US Dollar
</TD>
</TR>
<TR>
<TH vAlign=top align=left>
Teken*:
</TH>
<TD vAlign=top>
<INPUT value=$ name=valuesign>
</TD>
</TR>
<TR>
<TH vAlign=top align=left>
Correctie faktor*:<BR>
<SMALL>Voor (meer) informatie:<BR>
<A target=_blank href="http://www.oanda.com/converter/classic?value=1&exch=NLG&expr=USD">
Valuta Correctie faktor</A><BR><BR>
1 NLG = 0.40995 USD</SMALL>
</TH>
<TD vAlign=top>
<INPUT type=hidden value=0.40995 name=correction_old>
<INPUT onkeypress="return validateNumber(event)" value=0.40995 name=correction>
<SMALL>(Last update: Donderdag, 16 Augustus 12:24:35 2001)</SMALL><BR>
<SMALL><INPUT onclick=ch(this) type=checkbox value=1 name=view_correction>
Aanvinken om de valuta correctie faktor te bekijken<BR>
<INPUT onclick=ch(this) type=checkbox value=1 name=update_correction>
Aanvinken om de valuta correctie faktor up te daten<BR></SMALL>
<DIV id=myId style="VISIBILITY: hidden">
<SELECT name=margin_fixed>
<OPTION value=0 selected>Interbank rate
<OPTION value=1>Interbank rate 2
<OPTION value=2>Interbank rate 3
<OPTION value=3>Interbank rate 4</OPTION>
</SELECT>
</DIV>
<SMALL>
<INPUT onclick=ch1(this) type=checkbox value=1 name=view_currency_value>
Of aanvinken om de waarde te gebruiken</SMALL><BR>
</TD>
</TR>
</TABLE>
<DIV id=myId1 style="VISIBILITY: hidden">
<TABLE width="100%" border=1>
<TR>
<TH vAlign=top align=left width=200>
Waarde in <I>Dutch Guilder</I>*<BR>
<SMALL>Voor (meer) informatie:<BR>
<A target=_blank href="http://www.oanda.com/converter/classic?value=1&exch=USD&expr=NLG">
Waarde in Dutch Guilder</A><BR><BR>
1 USD = 2.43932 NLG</SMALL>
</TH>
<TD vAlign=top>
<INPUT type=hidden value=2.43932 name=currency_value_old>
<INPUT onkeypress="return validateNumber(event)" value=2.43932 name=currency_value><BR>
</TD>
</TR>
</TABLE>
</DIV>
<TABLE width="100%" border=1>
<TR>
<TH vAlign=top align=left width=200>
Aktief:
</TH>
<TD vAlign=top>
<SELECT name=active>
<OPTION value=Yes>Ja
<OPTION value=No selected>Nee*</OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD align=right colSpan=2>
<SMALL>*verplicht</SMALL>
</TD>
</TR>
<TR>
<TD align=middle colSpan=2>
<INPUT type=submit value=Aanpassen>
</TD>
</TR>
</TABLE>

</FORM>
</BODY>
</HTML>

It works fine. But when I check one of the checkboxes called view_correction or update_correction a SELECT tag will be made visible. The strange thing is that under this tag will appear a lot of free space (about 3 - 4 lines). I don't know where is comes from?? How to make this disappear? I only want to have the SELECT tag to be visible!
ASKER CERTIFIED SOLUTION
Avatar of a.marsh
a.marsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of weversbv
weversbv

ASKER

Are there more part in the page that can be better?
Could you make it working for netscape also?

I will increase to 200 points!
Okay - I'll see what I can do.

Do you realise there is a layer inthere called myId1 which is never used? Is this correct?


:o)

Ant
It will be used in line 134
<DIV id=myId1 style="VISIBILITY: hidden">

I hope you can help me!
You're going to have problems getting this to work in Netscape 4.x - the biggest problem is that you cannot have parts of a form inside a layer - Netscape considers that to be a completley separate form.

It is going to take quite a bit of code to try and get this working.

:o\

Ant
Will you take a try for 300 points?
Of course - I try to help wherever I can - the only thing to bear in mind is that it might take me a few days (or a little bit more) to put it together. That ok?

:o)

Ant
That would be nice!
Do you think you will come with an answer?
If not please tell me also!!
Sorry weversbv, this question completely slipped my mind.

The best thing I can suggest is wrapping this question up with the 100 points ( and a grade A I hope? :o) ) as I have answered your original question.

Then post a new question for 200 points (more experts are likely to look at it then) asking for the code to be adjusted to work in Netscape.

This way you will have the best chance of getting a quick solution from all the other experts aswell as just me.

Once again, please accept my apologies for not getting back to you.

:o)

Ant
Thank you for this part of the question!
No problem - glad to help. :o)

Ant