...

View Full Version : Error: Error in parsing value for property 'display'. Declaration dropped.



Flic
05-25-2006, 08:50 PM
I keep getting the above error and as far as I can see there is nothing wrong with the code, so its puzzling me somewhat. I'm getting the comment from the FireFox javascript console and for the line it says 0 so thats no use.

The javascript is:

function colourCheck(selected, other, colour){
if ( "Other colours" == selected[selected.selectedIndex].value ){
other.style.display = "";
}
other.style.display = "none";
}

I know the if statement works, but not what i want it to do rather annoyingly.

Its being called from:

<tr valign=top><td width=100>Item name:</td>
<td><input type="text" name="item1" size=50 onKeyPress="javascript:nextitem(item2, other1, colour1)"></td>
<td align=center><select name="colour1" onchange="colourCheck(this, 1)">
<option value="Jet and Black Diamond">Black / Grey</option>
<option value="Capri and Aquamarine">Blue / Light Blue</option>
<option value="Amethyst and Light Amethyst">Purple / Light Purple</option>
<option value="Light Siam and FireOpal">Red / Orange</option>
<option value="Garnet and Light Rose">Dark Red / Pink</option>
<option value="Other colours">Other colours</option></td>
<td><input type="text" name="other1" size=20 style="display:none"></td></tr>

I'm guessing this is where the problem is, as when I removed the style from the javascript it was still coming up, but I can't see what the problem is.

Any help much appreciated!

Arty Effem
05-25-2006, 09:15 PM
I keep getting the above error and as far as I can see there is nothing wrong with the code, so its puzzling me somewhat. I'm getting the comment from the FireFox javascript console and for the line it says 0 so thats no use.
I think you'll find it's commenting upon your CSS, not your script. It does that...

Beagle
05-25-2006, 09:16 PM
That is a CSS error. So either it's because you left the semi-colon off of the style declaration in your input field or you have some bad data in your style sheet.

I'm pretty sure if you look at that error in the console you should see a red stop sign with the letters "CSS" inside it.

Flic
05-26-2006, 09:13 AM
Ok, so that would explain it if I had any CSS in it, but I don't.

GJay
05-26-2006, 10:29 AM
There's CSS in the code you posted, so I'm thinking your general understanding is fairly low...

When the error comes in the console, you might notice that it gives you a link to the location of the error- did you try clicking this?

Kor
05-26-2006, 11:00 AM
anyway all the javascript code and event handlers there are a real mess, the comparision is upside down, the objects (select, options are mixted up), selected is a javascript reserved word, objects are refered incorrectly (should have had a document root)... I bet you work only with IE

Flic
05-26-2006, 12:34 PM
#5 I'm mainly self taught and CSS is the next thing that I am planning to learn, and I didn't notice (although now I see) that the display was an example of it. I'm in no way a beginner, but I guess I may seem so to some of you. I'm one of those people that learn things by doing them, hence me currently building a site to expand my skills and make me learn new things. Also, as I'd already mentionned it said Line 0 which is of no use, and I did have a look through the link, the only things in red were a few missing >'s and &nbsp's (why?).

#6 Having another look at it I can see that some variables are being called into the wrong methods, oops! And actually I test all my pages in Firefox, and the only thing that doesn't work is some mouseovers, but thats decorative not a functional so i'm not that bothered by it. What annoys me is that this code works on several other pages (5 to be exact) so why not here?

New calling code:


<tr valign=top><td width=100>Item name:</td>
<td><input type="text" name="item1" size=50 onKeyPress="javascript:nextitem(item2, colour2)"></td>
<td align=center><select name="colour1" onchange="colourCheck(this, other1)">
<option value="Jet and Black Diamond">Black / Grey</option>
<option value="Capri and Aquamarine">Blue / Light Blue</option>
<option value="Amethyst and Light Amethyst">Purple / Light Purple</option>
<option value="Light Siam and FireOpal">Red / Orange</option>
<option value="Garnet and Light Rose">Dark Red / Pink</option>
<option value="Other colours">Other colours</option></td>
<td><input type="text" name="other1" size=20 style="display:none"></td></tr>


Its the colourCheck that doesn't work, same reason as stated before.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum