Results 1 to 2 of 2

Thread: Style Sheet Switcher Problem

  1. #1
    Join Date
    Jan 2009
    Location
    Las Vegas
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Style Sheet Switcher Problem

    1) Script Title: Style Sheet Switcher

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...etswitcher.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:

    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

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

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

    Code:
    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
    DD Admin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •