Results 1 to 4 of 4

Thread: Switch Content Script

  1. #1
    Join Date
    Jan 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Switch Content Script

    Script: Switch Content
    URL: http://www.dynamicdrive.com/dynamici...tchcontent.htm

    I have found an interesting issue with this script. When the collapsible content area contains an <input> tag with the name 'length', the script fails! It took me some time before I figured this one out! I completely gutted my page before I did, but naming the input tag 'length' was the culprit. I also tried just having the word length in there, but that was OK. It only seems to happen when I name the tag length. I even copied the code on the page and it worked great until I added the input tag.

    So I hope this qualifies as a bug! If it does does that mean I get a cookie or something? I like chocolate chip, but a peanut butter cookie sounds good right now too.

    Anywho, hopefully someone can respond to this and let me know what's up with this one.

    --ScareCrowe

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Length is a reserved word. Not perhaps in any particular sense, though it may be. However, when you tell a browser that name=length, you are saying that one attribute equals another. Especially if you do it without quotes as I have just done. If you were to use name="length", it would be less likely to cause a problem but , who knows? How did you have it? In any case, I wouldn't call that a bug of the script. If you used quotes, I'd call it a browser bug. If you used it without quotes, simply sloppy coding.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Very interesting. I tried duplicating the problem, and it seems to only occur in IE (not Firefox, for example). This isn't a script of the bug as far as I can see though- in theory, you're free to use any HTML within the content to be expanded/collapsed, as all the script does is manipulate the display property of the container for each content, not the actual content. The fact that name="length" trips up IE can only be explained by an internal bug with the browser.

  4. #4
    Join Date
    Jan 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks guys, it must be an IE issue then. Yes jscheuer1, I did use quotes, single and double. No sloppy coding here. I was thinking that if the ID attribute of the input tag was 'length', that could account for the issue, as the script uses getelementbyid(), and perhaps somewhere that was mucking it up, but not the name attribute. Anywho, thanks all for checking this out! Guess I'll have to wait on my cookie till another day!

    --ScareCrowe

Bookmarks

Posting Permissions

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