473,625 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MSIE Incompatibility : Selection by changing <li> style attribute

4 New Member
Hello everybody! I've just registered to this forum and yet got a question. :)

I've got some database, that is processed by PHP in a 'while' loop and each element that the loop draws (<li>) gets an unique ID and href to the javascript function, that should change its background color and post the ID to some invisible <input>. Actually it works pretty fine - but not in MSIE (tested on NT5.1 SP2). The debug info is absolutely idiotic and i have no idea how to make the script compatible for both, Gecko and MSIE.

Generated HTML looks like that:
[HTML]
<head>
<script language="javas cript" type="text/javascript" src="components/FileBrowser.js" ></script>
</head><body>

<div id="vfiles"><ul >

<li id="30">
<a href="#" onClick="Select File('30');"><i mg class="icon" src="images/icons/file_subsite.gi f"><div class="names">< span class="name">So me item</span></div></a></li>
<li id="34">
<a href="#" onClick="Select File('34');"><i mg class="icon" src="images/icons/file_subsite.gi f"><div class="names">< span class="name">So me other item</span><br><span class="name2">A nd its sub description</span></div></a></li>
<li id="32">
<a href="#" onClick="Select File('32');"><i mg class="icon" src="images/icons/file_subsite.gi f"><div class="names">< span class="name">An d another</span><br><span class="name2">W ith its description</span></div></a></li>
[/HTML]
And so on.

The SelectFile() function in FileBrowser.js as well as it's main part looks like:
Expand|Select|Wrap|Line Numbers
  1.  /* # GLOBAL declarations */
  2.  var oldSelection = 0;
  3.  var Nothing=null;
  4.  
  5.  /* ## Selecting file */
  6.  function SelectFile(File_ID) {
  7.  
  8.         // fill the 'insert' form component
  9.         document.forms["selection"].selected.value=File_ID;
  10.  
  11.         // deselect previous selection (if any)
  12.         if(oldSelection) {
  13.                 document.getElementById(oldSelection).style.background='';
  14.         }
  15.  
  16.         // select current choice
  17.         document.getElementById(File_ID).style.background='#A5D8A7;';
  18.  
  19.         // return new variable
  20.         oldSelection = File_ID;
  21.         return oldSelection;
  22.  }
  23.  
Can any of the experts here tell me what did i make wrong? I'll be really thankful for any of help. Thanks!

PS. Sorry for my english. :)
Jun 1 '06 #1
2 2363
celtique
4 New Member
Hm.
Is my problem that hard to solve?
Jun 4 '06 #2
acoder
16,027 Recognized Expert Moderator MVP
The semi-colon will cause problems:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(File_ID).style.background=  '#A5D8A7';
Also, IDs should not start with a number.
Jun 22 '08 #3

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

Similar topics

1
3704
by: Randall Sell | last post by:
OK, I am utterly stumped. The code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style type="text/css"> ul { background-color: red; }
5
9244
by: toylet | last post by:
Attached is some css codes for a website. It has 3 parts: top-bar, side-bar (on the left) and main-body. The top-bar has a mouseover menu called top-menu implemented via ul:hover. When the mouse pointer hovers over the top-menu, the bottom margin of the top-bar expands downwards. How could I make the hover menu to stack on top of the main-body, not expanding the bottom margin of the top-bar? I believe it has something to do with...
8
61491
by: Udo Marx | last post by:
Hello to ciwas! Is there a way to change the bullet form, color, etc, of the element <li> under<ul> via css? Any reply will be appreciated. -- Freundliche Gruesse, Netzteil - Udo Marx http://www.netzteil.com mailto:marx@netzteil.com
4
9529
by: Matt | last post by:
Hi, Got an unordered list with 100% width, with 5 list items of 20% width styled to fill the width of the container element. Renders fine in Mozilla, but when you change the size of the window in IE, the last item in the list has a nasty tendency to wrap down to the next line (and stay there). I can hack it (imperfectly) by setting the width of the list items to
2
7628
by: Shaun | last post by:
Hello! I have a quick question regarding CSS and having it applied to all elements. I am trying to eliminate the gap between a paragraph and a list that usually occurs in html and I've found away to do that with this code: <p>a</p> <ul style="margin-top: -20; padding-top: 0"> <li>1</li>
5
4477
by: Syl | last post by:
Hello experts!! The top menu navigation bar displays perfectly in IE, but does not display properly in Mozilla or Netscape : http://checkeredshirt.com/textonly.html For some reason the non-IE browers are forcing the top navigation menu to dislpay "staggered" after the the first <ul><lielement. Can anyone see why this is happening ?
2
5959
by: mike_newsgroups | last post by:
Hello everyone, Anyone know how can I change the 30px below to a different value from a javascript function? <table> <tr> <td> <div id="star-rating"> <ul>
2
7050
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so the entire block is clickable, not just the text. I've sorta got it so it's clickable, just some parts of the button I still can't click on. The website is http://pdhtdev.johnabbott.qc.ca/students/2010/james_mann/portfolio/index.htm The css...
6
4466
by: capricious | last post by:
Is it possible, so that when you do multiple <UL>'s to control how deep the UL's are marked? For example, it would defaultly look like this with multiple ULs and LIs: -- Code : Main Menu<ul>Fruits<ul><li>Apples</li><li>Oranges</li></ul></ul> .. -- Returns :
0
8251
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
8688
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
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8352
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7178
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
6115
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
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
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.