Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Error: Error in parsing value for property 'display'. Declaration dropped.

    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:
    Code:
    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:
    Code:
    <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!

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Flic
    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...

  • #3
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    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.

  • #4
    New Coder
    Join Date
    May 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, so that would explain it if I had any CSS in it, but I don't.

  • #5
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    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?

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    New Coder
    Join Date
    May 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    #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:
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •