Jump to:

23355 Posts in 17702 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Javascript won't work in IE

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 1972 Views
  • Briohny
    Avatar
    Community Member
    199 Posts

    Javascript won't work in IE Link to this post

    I want to use this menu: http://www.artviper.eu/mootoolsmenu/

    I've placed all the files in my javascript folder and called them via requirements in the page.php file. It works perfectly in Firefox but not IE. Any ideas anyone?

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Javascript won't work in IE Link to this post

    Perhaps you need to ask over on the mootools site. Which IE version you talking about? 6?

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: Javascript won't work in IE Link to this post

    IE7. I can get it working normally when i apply the script to a standard HTML page... just can't get it working through Silverstripe.

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: Javascript won't work in IE Link to this post

    It seems to be in the code:

    window.onload=function()


    in one of my javascript files

    If i take that away it still doesn't work but there is no error message.

    Can anyone help please?

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: Javascript won't work in IE Link to this post

    Ok, i've nearly given up. Can someone just confirm that i'm putting all the right files/scripts in the right places... i'm sure this is an easy solution.

    1) Requirements::javascript("mysite/javascript/mootools.js"); - js file source as per mootools website code
    Requirements::javascript("mysite/javascript/mootools2.js"); - js code that was embedded in HTML page but has been moved into the javascript folder to keep separate from page.ss

    Both of these files are being called from page.php

    2) Add menu code to page.ss

    <div id="container">
    <div id="menu">
    <% control Menu(1) %>
    <ul style="padding: 0;margin: 0">
    <li class="$LinkingMode"><a href="$Link" class="toggler" title="$Title.XML">$MenuTitle</a></li>
    </ul>
    <% end_control %>
    </div>
    </div>

    3) CSS has been added

    Is there something else i'm missing? Do i have to put extra code in the actual page.ss file?

    Can someone please let me know. It's driving me nuts!

  • Briohny
    Avatar
    Community Member
    199 Posts

    Re: Javascript won't work in IE Link to this post

    Could it be a doctype issue?

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Javascript won't work in IE Link to this post

    You could test your theory by opening your _config.php file in the mysite/ folder and add this line

    ContentNegotiator::disable();

    See http://doc.silverstripe.com/doku.php?id=ContentNegotiator

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Javascript won't work in IE Link to this post

    Hi Briohny

    Did you try:

    window.addEvent('domready', function() {
    // your init code here
    });

    instead of window.onload=function() too?

    1972 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.