jigsawsoul Posted January 16, 2010 Share Posted January 16, 2010 I'm don't have any understanding of JS or Mootools but a friend of mine was helping me create this below. this script basically at the moment, changes what current link is selected and highlights that link. but the html requests are not working, it just gives me a JS pop up book with the test.php text inside. doesn't change the div. any help making it stop the div and change the div on index.php menu.js var Menu = new Class({ Implements : [Options,Events], els : [], current : null, initialize : function() { this.current = $$( '.current' )[0]; this.target = $( 'main-content' ); this.els = $$( '.dyno' ); this.els.each( function( e ) { e.addEvent( 'click', this.getPage.bind( this ) ); }.bind( this )); }, getPage : function( e ) { e = e.target; this.current.removeClass( 'current' ); this.current = e; this.current.addClass( 'current' ); if( !e.getProperty( 'href' ) ) { return; } new Request.HTML({ onSuccess : function( a, b, c, d ) { this.setContent( c ); }.bind( this ) }).get( e.getProperty( 'href' ) ); return false; }, setContent : function( e ) { alert( this.target.innerHTML ); this.target.innerHTML = e; } }) window.addEvent( 'domready', function() { new Menu(); })] test.php <li> <a href="#" class="nav-top-item"> Meetings </a> <ul> <li><a class="current dyno" href="_template/test.php">Meetings One</a></li> <li><a class="dyno" href="#">Meetings Two</a></li> <li><a class="dyno" href="#">Meetings Three</a></li> </ul> </li> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.