<div class="clearboth"></div>
<!-- Menu -->
<script type="text/javascript">
myButton('HOME','_home.htm');
myButton('ABOUT US','_about.htm');
myButton('SERVICES','_services.htm');
myButton('SOLUTIONS','_solutions.htm');
myButton('CONTACT US','_contact.htm');
</script>
</div>
function myButton (buttonText,buttonLink) {
if (!online && !isIE) {
document.write(' <DIV ID="flashMovie'+(anim_ids+1)+'" STYLE="width: 200; height: 31; z-index: 100;" onClick="showPage(\''+buttonLink+'\','+anim_ids+1+')">');
}
AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width','200','height','31','src','flash/button','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','flash/button','flashvars','custom_xml_url=button.xml&item_text='+buttonText+'&item_url='+buttonLink+'&button_id='+(anim_ids+1)+'&isIE='+isIE,'scale','noScale','wmode','transparent');
if (!online && !isIE) {
document.write('</DIV>');
}
}
What happens when you actually click on one of these dynamically generated buttons?
There are a whole host of potential problems :
- FURLS are setup correctly
- URLS are formed correctly
- Might not be triggering because content is added after the dom is loaded
Maybe start by explaining to us why you are doing your menu this way, as it might give us a better understanding.
myButton('HOME','new url here');I have done something similar using jquery's load method here :
http://www.mikegarlick.com/
Love that functionality! Nice touch, really classy.
myButton('HOME','_home.htm');
myButton('HOME','location of my modx page');
hideContent = function(contentString,transition){
if (transition==null) {
jQuery("div.dynamicContent").fadeOut( 1000 ,function() {
showContent(contentString);playSound(0);
});
} else {
jQuery("div.dynamicContent").slideUp( 1000 ,function() {
showContent(contentString);playSound(0);
});
}
};
showContent = function (contentString) {
jQuery.ajax({
type: "GET",
url: contentString,
dataType:"html",
success: function(data){
jQuery("div.dynamicContent").html(data);
jQuery("div.dynamicContent").slideDown(1000);
},
error: function () {
alert("Page "+contentString+" not found");
}
});
function showPage(pageURL,button_id) {
if (pageURL.substring(0,4).toLowerCase()=='http') {
window.open(pageURL, '_blank');
return;
};
hideContent(pageURL,'slideUp');
if (selected_button!="" && button_id!=selected_button) {
sendToASUnselectButton('anim_'+selected_button);
}
if (button_id!=undefined) {selected_button = button_id;}
}
function hideContent (contentString,transition){
if (transition==null) {
$("div.dynamicContent").fadeOut( 1000 ,function() {
showContent(contentString);
playSound(0);
});
} else {
$("div.dynamicContent").slideUp( 1000 ,function() {
showContent(contentString);
playSound(0);
});
}
}
function showContent (contentString) {
$.ajax({
type: "GET",
url: contentString,
dataType:"html",
success: function(data){
$("div.dynamicContent").html(data);
$("div.dynamicContent").slideDown(1000);
},
error: function () {
alert("Page "+contentString+" not found");
}
});
}
function showPage(pageURL,button_id) {
if (pageURL.substring(0,4).toLowerCase()=='http') {
//The '_blank' attribute is making it open in a new tab.
window.open(pageURL, '_blank');
return;
};
hideContent(pageURL,'slideUp');
if (selected_button!="" && button_id!=selected_button) {
sendToASUnselectButton('anim_'+selected_button);
}
if (button_id!=undefined) {selected_button = button_id;}
}