HTML and Scripting Javascript is kicking my ***

Discussion in 'Computers' started by Reisti Skalchaste, Jan 11, 2006.

  1. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    Well, I've posted this everywhere. vB.com, some web developer forum, and I've asked a few friends, and none have proven helpful yet.

    In any case, I've got a sliding javascript menu, it's designed for phpBB, but I want to make it work on a vBulletin forum. I know where to paste the code in vBulletin, but when I do I get a messy failure of a menu that doesn't work at all. I'm wondering if anyone here would know anything about Javascript and be able to help me fix this?
     
    #1
  2. Slydice

    Slydice ave, Lex, morituri te salutamus

    Joined:
    Apr 4, 2002
    Messages:
    281
    Likes Received:
    16
    If it works elsewhere, then I'd say there might be some javascript or style variables or names already being used by vBulletin that your ones might be conflicting with.

    The menu definitly works good on a regular webpage?
     
    #2
  3. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    I tried putting the menu on a blank .html page, and it gave the same errors it gave when I tried pasting it into vBulletin. However it's error-free in phpBB, so it leads me to believe it has some hook or dependency on a phpBB file, however I've had no luck figuring out what that would be.

    I've attached the original modification file, perhaps you could take a look at it and see if you can locate the problem?

    I know it's not something with the phpBB language packs, I've replaced all of the links at the bottom at one point to see if it was and still got the same errors, and it works with <a href="URL"> links as it is.
     

    Attached Files:

    #3
  4. BakaMattSu

    BakaMattSu ^__^
    Staff Member

    Joined:
    Feb 16, 2001
    Messages:
    4,871
    Likes Received:
    122
    Could you elaborare on exactly what errors you are receiving? Are they actual runtime errors, or is it just not displaying as you want it to?

    I tried your snippet in a browser, and didn't run into any scripting errors.
     
    #4
  5. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    Let's see... the menu doesn't slide along the side of the screen, it remains stuck in an "out" position, and that's actually it, I think. It gave the same problems it both vBulletin (pasted at the bottom of the headinclude template) and in plain html. I have taken screenshots, if you want me to post them.

    I don't have phpBB software any longer, but I can tell you it has worked for me in phpBB.

    There was a function I'd wanted to add to it but gave up on awhile back, and that's simply to have a secondary menu slide out upon mouseover of one of the options in the existing menu.
     
    #5
  6. BakaMattSu

    BakaMattSu ^__^
    Staff Member

    Joined:
    Feb 16, 2001
    Messages:
    4,871
    Likes Received:
    122
    Strange. Seems to function fine from plain HTML in both Firefox 1.0.7 and IE 6 for me. Starts closed on the left, slides out when I roll over, slides in when I roll off, and the CNN link brings me to that page. What are you viewing it in?
     
    #6
  7. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    I'm using Firefox 1.5, although trying it in IE 6 also gave me problems. In IE 6 the menu is... sorta stuck. It's the width of it when it should be "in," but it doesn't slide out and all the links appear as though it were "out," instead of the bar labelled "Navigation"

    Very strange, if it's not working for me but working for you. :/ I don't suppose you could try it in vBulletin to see if it would work there for you?

    http://www.vbulletin.com/admindemo.php
    ^~The admin demo so you don't have to mess with BJP if you don't want to. :p
     
    #7
  8. Slydice

    Slydice ave, Lex, morituri te salutamus

    Joined:
    Apr 4, 2002
    Messages:
    281
    Likes Received:
    16
    #9
  9. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    Er, yes. :p

    I had the links and such changed in the menu options, although I had assumed the rest of it would work normally outside of phpBB, and BMS apparently had it working...

    Edit: Slydice, it's exactly as it was supposed to be, although it's supposed to have a tab of sorts on the right-hand side of the menu that's labelled "Navigation." Also it seems to be making the page flash when I mouseover an option, and not the good kind of flash. ;)

    It's weird that it doesn't work for me. I added it to my under-construction main page, let me know if it works for you:
    http://www.shoujo-anime.net/main.html

    Yes, it's a really crappy page. :eek:

    Also, Jake Bunce told me that I should put custom javascript in the headinclude template, here:
    http://www.vbulletin.com/forum/showthread.php?t=166814
     
    #10
  10. Slydice

    Slydice ave, Lex, morituri te salutamus

    Joined:
    Apr 4, 2002
    Messages:
    281
    Likes Received:
    16
    Well, just looking at your source, you've got the script under the closing html tag
    kinda like this:

    <html>

    <head>
    </head>

    <body>
    </body>

    </html>
    script is here


    but you should try putting it into the body and preferably at the very top of the body like so:

    <html>
    <head>
    </head>

    <body>
    script is here
    </body>

    </html>

    Saying that though, I'm not so sure if that is the main problem at all and as I think right now, it shouldn't be.
     
    #11
  11. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    Indeed, it didn't fix the problem, though now it's tucked nicely in the top left corner. :p Something's keeping it from sliding, and it's not an issue on your page, for some reason. Therefore it would have to have something to do with the content of mine?
     
    #12
  12. BakaMattSu

    BakaMattSu ^__^
    Staff Member

    Joined:
    Feb 16, 2001
    Messages:
    4,871
    Likes Received:
    122
    The proof is in the pudding, or in this case the DOCTYPE.

    The particular menu (or parts of it) you're using doesn't appear to be W3C compliant, not even in the transitional sense. How can I tell? I removed the entire <!DOCTYPE> tag from the file altogether and the menu worked like a charm.

    You might find the following reference useful:
    Mozilla's Guide to DOCTYPE sniffing

    Summary: A workaround to your issue would be to run your document in "quirks mode". Otherwise you'll need to narrow down the parts of the script and generated HTML to find what isn't compliant, and rewrite them.
     
    #13
  13. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    Holy hell that looks llike a lot of work. :( I don't have the time or knowledge to go through all of that...

    Thanks for the help though, I appreciate it. I'll take a look at it at some point and see what I can do, although my very limited knowledge means I probably won't get it working on my own...
     
    #14
  14. BakaMattSu

    BakaMattSu ^__^
    Staff Member

    Joined:
    Feb 16, 2001
    Messages:
    4,871
    Likes Received:
    122
    The easy solution is just to rip out the DOCTYPE declaration from the top of your page. Any browser that reads that tag will likely kick into "quirks mode" if it finds it absent.
     
    #15
  15. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    Well, it worked... to an extent, now the sidebar of the menu is missing, and it just shows a portion of the menu itself...

    I tried adding the doctype from phpBB's overall_header.tpl, and the menu still works, but the problem remains.
     
    #16
  16. Slydice

    Slydice ave, Lex, morituri te salutamus

    Joined:
    Apr 4, 2002
    Messages:
    281
    Likes Received:
    16
    It looks good to menu, although I don't know how it is supposed to look.
     
    #17
  17. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
  18. Reisti Skalchaste

    Reisti Skalchaste New Member

    Joined:
    Jun 14, 2004
    Messages:
    3,554
    Likes Received:
    137
    Well, I hate to double post, but I never did get it solved...

    The problems I'm having at the moment:
    • When the menu is "closed," it displays a portion of the menu itself. When I had it running on phpBB, and in the example above, there was a sidebar that displayed "Navigator" that is curiously absent when used elsewhere.
    • I have no idea if this is possible or not, but I'd like to minimize the changes I make to my templates, so I'd like to upload the javascript in a separate file and reference it from the template- viewing the source on BJP it seems Cloud's done exactly that, and that's where I got the idea. In this case, however, I believe I'd need to also reference the colour and style settings from the templates, so I can change it for my various styles.
    • Plain colour is kinda ugly, would it be at all possible to use background images?
    • I'd like someone to give me a foot massage every day when I get home from work and.... while we're at it, why don't we just get someone to go to work for me? :p

    I think that's everything I can't handle on my own... let's especially try and get that fourth one, eh? A foot massage would be reeeally nice right about now. :D

    Edit: I should mention, in case it's not obvious already, I'm a complete n00b at this. Would you mind explaining everything very carefully, for the sake of not having me having to ask question after question ad nauseam? :p
     
    #19
  19. luvweaver

    luvweaver Ad Jesum per Mariam

    Joined:
    May 13, 2002
    Messages:
    1,196
    Likes Received:
    60


    • Let's suppose your navigation bar in question is called "mynav".

      mynav.style.display='none';
      // or
      document.getElementById('mynav').style.display='none';
      // just remember to set it to 'block' when you display it back.

      The functions use the current document, so there shouldn't be any problem with it.

      Yes, but it's a royal pain in the back, specially if you want the background to change. Otherwise, just style them using CSS.

      file.css
      .menu (or whatever) { background-image:url(yourfile.gif); }

      Sure, do you have a million dollars? :D
     
    #20

Share This Page