Solved

hide - visible SELECT tag

Posted on 2001-08-18
12
1,041 Views
Last Modified: 2008-01-16
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&amp;exch=NLG&amp;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&amp;exch=USD&amp;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!
0
Comment
Question by:weversbv
  • 6
  • 6
12 Comments
 
LVL 15

Accepted Solution

by:
a.marsh earned 100 total points
ID: 6400334
Change:

objheight=Obj.offsetHeight;


to:

objheight = 30;

for example and you'll see a difference.

:o)

Ant
0
 

Author Comment

by:weversbv
ID: 6400681
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!
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6400745
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
0
 

Author Comment

by:weversbv
ID: 6400805
It will be used in line 134
<DIV id=myId1 style="VISIBILITY: hidden">

I hope you can help me!
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6401502
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
0
 

Author Comment

by:weversbv
ID: 6402907
Will you take a try for 300 points?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 15

Expert Comment

by:a.marsh
ID: 6403079
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
0
 

Author Comment

by:weversbv
ID: 6403384
That would be nice!
0
 

Author Comment

by:weversbv
ID: 6430941
Do you think you will come with an answer?
If not please tell me also!!
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6431007
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
0
 

Author Comment

by:weversbv
ID: 6432205
Thank you for this part of the question!
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6433367
No problem - glad to help. :o)

Ant
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now