PDA

View Full Version : Style Sheet Switcher Problem



Toygrubin
01-23-2009, 01:45 AM
1) Script Title: Style Sheet Switcher

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm

3) Describe problem: I have succesfully installed the style switcher and it appears to be working properly. However, the drop down select menu is not remembering the chosen selected style. I have added the following code:


<script type="text/javascript">
window.onload=function(){
var formref=document.getElementById("switchform")
indicateSelected(formref.switchcontrol)
}
</script>

into the <HEAD> section and it still does not appear to be working. I am using IE7.

The url to my test pages is: http://www.positiveratio.com/lindaswebsite/index.html

I currently only have the dropdown menu on the index.html and the index-1.html pages while i try and get this working properly.

Thank you for any help you can supply,
Chris

ddadmin
01-23-2009, 05:06 AM
Looks like window.onload is being used by another script on your page, hence being overwritten. Try replacing what you currently have on the page:


window.onload=function(){
var formref=document.getElementById("switchform")
indicateSelected(formref.switchcontrol)
}

with:


function addEvent(target, functionref, tasktype) {
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false);
else if (target.attachEvent)
target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
}

addEvent(window, function(){
var formref=document.getElementById("switchform")
indicateSelected(formref.switchcontrol)
}, "load")

BTW, please note that your page is currently in violation of our usage terms, since the credit notice doesn't appear inline on the page. Please reinstate the credit notice: http://www.dynamicdrive.com/notice.htm