Solved

hide - visible SELECT tag

Posted on 2001-08-18
12
1,063 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&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!
0
Comment
Question by:weversbv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

740 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