views:

140

answers:

4

I'm working on a site written in PHP/MySQL. We have a form to reserve time on a calendar and it works great in Mozilla and stores the reservation to our database, but in IE you fill out the form and when you click the "Reserve" button to submit it and nothing happens. All I can think of is that my javascript is not working with IE. I have these lines in my .js file:

 resLenT = document.getElementById(resLenElem);

 resLenI = resLenT.selectedIndex;
 resLen = resLenI + 1;

where resLenElem is a drop-down box. These are the only lines that I can think of at the moment that might be causing trouble in IE. Does this all sound like I'm on the right track or am I way off base?

+4  A: 

try:

resLenT = document.getElementById("resLenElem");

notice the quotes around resLenElem

MANCHUCK
Wow, thanks for the fast reply. The quotes actually cause Mozilla to do the same thing that IE is doing already. There is no errors thrown or anything, it just doesn't do anything
Jake
A: 

So in the event that it is actually something in my html that is causing the IE failure, this is my html:

Length of Reservation:<br />
<select id="resLen" name="resLen" style="border:1px solid #000000;padding:2px">
    <option selected>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>
    </select> hr(s)<br /><br />

Am I messing something up there and IE isn't likeing it?

Jake
notice that the Id is resLen and not resLenElem as you posted before. so you would need to do: resLenT = document.getElementById("resLen");
MANCHUCK
oh, sorry i didn't clarify that. i use resLenElem because it is inside a function and "resLen" is passed in as the "resLenElem" element. but its all up and working now. Thanks for the help!
Jake
+1  A: 

Alright, I figured it out. The problem is that I used the name and id "resLen" for my drop-down box in the php file. Then in my js file, I also called it "resLen". Mozilla was able to look at the js and php files as independent items, but IE was getting confused. Thanks again for all the fast replies! Much appreciated!

Jake
A: 

as far as I know, IE seems not to make the difference between the name and the id of an element.

daiana