OK, make the links like so:
Code:
<a href="#" onclick="ajaxpage('t.php', 'rightContent');">Current or not</a>
Do not use the javascript: prefix. That wasn't the problem, it's just unnecessary. And be sure to change all of the ajaxpage links to the above format.
The problem is that the SD Menu isn't designed for this. So we'll add some code to the onload function to make it work like we want it to. Replace this:
Code:
<script type="text/javascript">
// <![CDATA[
var myMenu;
window.onload = function() {
myMenu = new SDMenu("my_menu");
myMenu.init();
};
// ]]>
</script>
with:
Code:
<script type="text/javascript">
// <![CDATA[
var myMenu;
window.onload = function() {
myMenu = new SDMenu("my_menu");
myMenu.init();
var m = myMenu.menu.getElementsByTagName('a');
for (var i = m.length - 1; i > -1; --i){
if(/ajaxpage/.test(m[i].onclick)){
(function(old){
m[i].onclick = function(){
old();
myMenu.mark(this);
return false;
};
})(m[i].onclick);
}
}
myMenu.mark = function(link){
for (var i = m.length - 1; i > -1; --i){
if(m[i].className){
m[i].className = m[i].className.replace(/\bcurrent/, '');
}
}
link.className += link.className? ' current' : 'current';
};
};
// ]]>
</script>
Bookmarks