473,326 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

MSIE Incompatibility: Selection by changing <li> style attribute

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="javascript" type="text/javascript" src="components/FileBrowser.js"></script>
</head><body>

<div id="vfiles"><ul>

<li id="30">
<a href="#" onClick="SelectFile('30');"><img class="icon" src="images/icons/file_subsite.gif"><div class="names"><span class="name">Some item</span></div></a></li>
<li id="34">
<a href="#" onClick="SelectFile('34');"><img class="icon" src="images/icons/file_subsite.gif"><div class="names"><span class="name">Some other item</span><br><span class="name2">And its sub description</span></div></a></li>
<li id="32">
<a href="#" onClick="SelectFile('32');"><img class="icon" src="images/icons/file_subsite.gif"><div class="names"><span class="name">And another</span><br><span class="name2">With 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 2347
Hm.
Is my problem that hard to solve?
Jun 4 '06 #2
acoder
16,027 Expert Mod 8TB
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
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 {...
5
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...
8
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...
4
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...
2
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...
5
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...
2
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
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...
6
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.