473,796 Members | 2,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript div hide/show problem in IE

Chittaranjan
51 New Member
Hi All,

I am having a problem using Javascript in Perl script. In the perl module I have included the Javascript codes and that is workign fine for validation purpose but when I am trying to show and hide some divisions randomly selecting from a drop down menu then that is working fine in Mozilla but not working in IE 6/7. Here is some part of my code: if any suggestions please welcome...

Thanks,
Chittaranjan

This is the Javascript code I am using for div hiding and showing
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!--
  3. function showOptionals(field) {
  4.     var loc = document.getElementById('noOfItems').value;
  5.     for ( i = 1; i <= loc; i++ ) {
  6.         var sel = document.getElementById('sel-tlcode-'+i).value;
  7.         if ( i == sel ) {
  8.             document.getElementById(i).style.display='block';
  9.         }
  10.         else {
  11.             document.getElementById(i).style.display='none';
  12.         }
  13.     }
  14. }
  15. //-->
  16. </script>
  17.  
This is the perl script drop down where I am calling the Javascript function
Expand|Select|Wrap|Line Numbers
  1. print popup_menu(
  2.     -name        => 'sel-tlcode-' . $y,
  3.     -id            => 'sel-tlcode-' . $y,
  4.     -value        => \@xx,
  5.     -default    => $value{$label},
  6.     -class        => ( $errLabel eq $label ) ? 'formmsg' : 'formelements',
  7.     -title        => 'Select a location code that corresponds with a location list in the section below.',
  8.     -tabindex    => $tabindex,
  9.     -onChange    => "showOptionals(this);",
  10.     -force        => 1
  11. );
  12.  
This is the div which I want to show and hide randomly selecting from the drop down.....
Expand|Select|Wrap|Line Numbers
  1. print "<div id=".$a." style=\"display:none\">";
  2.  
Feb 26 '07 #1
2 3253
miller
1,089 Recognized Expert Top Contributor
(Moving thread to Javascript from Perl)

Hello Chittaranjan,

I understand that this html was generated using perl, but the nature of your problem is in the JavaScript, not the perl that is generating it.

I have a feeling that our friendly Javascript experts might need more information from you, but I'll let them ask if that's so.

- Miller
Feb 26 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Maybe you have not closed your div?
Feb 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3846
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following beautiful script "http://javascript.internet.com/navigation/toolbar-menu.html". It works like a charm. I made my webpage in frames, where the nav-frame shows the menubar, so whenever I click a link in the menubar, it opens in the frame below. But...
19
6934
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
1
14546
by: Oliver Hoehle | last post by:
Hello! This ist the source-code for an editable combobox implemented with HTML,CSS and Javascript. I have tested it with IE and Mozilla. But I don't know, if it will work in other browsers (Opera, Konqueror, etc.) So I need your feedback... Regards
7
2446
by: fernandoronci | last post by:
Hi, I've been given the task of mantaining and fixing a website which I didn't design. I'm using Internet Explorer 5.5 and 6.x. Specifically, the problem is that navigation menues (written in javascript) don't disappear when the mouse moves outside of the area of the menues (some of the menues are nested two and three levels). As long as the mouse cursor remains *within* the options of the menues, the option under the mouse cursor is...
5
2562
by: googlegroups | last post by:
I have a large table in html created dynamically. This table can grow to several hundred rows or more. I have the ability to hide or display individual rows (using row.style.display = "none") and this works well in both IE and Firefox. I would also like to do the same with columns as well. I did some research and col and colgroup nodes are not supported fully in both browsers. Also, doing "visibility: hidden" and sometimes "display:...
4
17057
by: James | last post by:
Hello group: I'm trying to hide a panel control in javascript when a print button is clicked. On my web form, I have a button that fires a javascript function called doPrint(). No matter how I attempt to write the line to reference the panel control, I get a Null error or an Object does not exist error. I know this can be done in asp.net, but I need the event to fire at the client, otherwise the page will print before firing the...
1
1339
by: Brenton | last post by:
Hi I'm new to the group so if I make a major blunder posting this here I apologise in advance. I'm not a Programmer by any stretch of the imagination and I've been trying to sort out a small JavaScript that I found here: http://www.interspire.com/content/articles/10/1/Building-An-Expanding-DHTML-Menu-With-CSS-and-JavaScript if I use what is supplied it works fine, but a little further down
1
4955
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: http://munich.schwarz-interactive.de/autocomplete.aspx
4
68274
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!!
7
3596
by: hollopeterb | last post by:
my javascript code works great in IE but not in Firefox, can anyone help? Thanks!! Here is the code: <script type="text/javascript"> <!-- function MM_findObj(n, d) { //v3.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames.document; n=n.substring(0,p);} if(!(x=d)&&d.all) x=d.all; for (i=0;!x&&i<d.forms.length;i++) x=d.forms; for(i=0;!x&&d.layers&&i<d.layers.length;i++)...
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.