Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Javascript won't work in IE


Go to End


9 Posts   3024 Views

Avatar
Briohny

Community Member, 199 Posts

3 April 2009 at 10:00pm

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?

Avatar
Sigurd

Forum Moderator, 628 Posts

4 April 2009 at 12:08am

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

Avatar
Briohny

Community Member, 199 Posts

4 April 2009 at 12:24am

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.

Avatar
Briohny

Community Member, 199 Posts

4 April 2009 at 1:39am

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?

Avatar
Briohny

Community Member, 199 Posts

4 April 2009 at 3:20am

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!

Avatar
Briohny

Community Member, 199 Posts

4 April 2009 at 3:25am

Could it be a doctype issue?

Avatar
Sigurd

Forum Moderator, 628 Posts

4 April 2009 at 7:21am

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

Avatar
bummzack

Community Member, 904 Posts

4 April 2009 at 10:59am

Hi Briohny

Did you try:

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

instead of window.onload=function() too?

Go to Top