View Full Version : SwitchContent Conflict on MovableType Powered Journal

06-18-2007, 08:25 AM
1) Script Title: SwitchContent

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm

3) Describe problem: It doesn't seem to work in MovableType. I wanted to use this script for my long archive list, which has been going on since June 2000 and a new link is posted monthly on my main page. It just does not seem to be compatible with MovableType, the software that I use to publish my journal with. I get the link on the site just fine, and I use the exterior link to the switchcontent.js. I made a demo page and the whole thing works fine in that, just not on my MovableType powered blog. Which is strange because other JavaScripts (rainbow links, no-right-click, etc) work just fine. Am I doing something wrong or does it just not work for MovableType users?

06-18-2007, 09:07 PM
Please post a link to the page on your site that contains the problematic script so we can check it out.

06-19-2007, 02:59 AM
Sorry. My bad.

The URL where it does not work:

The demo page, where it does work:

I copied and pasted it directly from the script page here into a blank DreamWeaver document. The only things I have changed on the journal page is I left out the part for "expand all" and "collapse all". I made a demo page because my host said some JS's are banned on his server because they're annoying.

I also moved the handcursor part to the styles in the usual CSS on the page.

06-19-2007, 06:58 AM
Ah I think I see the problem. In your actual page, you never initalized the script at the very end! Look inside demo.htm:

<script type="text/javascript">
// MAIN FUNCTION: new switchcontent("class name", "[optional_element_type_to_scan_for]") REQUIRED
//1) Instance.setStatus(openHTML, closedHTML)- Sets optional HTML to prefix the headers to indicate open/closed states
//2) Instance.setColor(openheaderColor, closedheaderColor)- Sets optional color of header when it's open/closed
//3) Instance.setPersist(true/false)- Enables or disabled session only persistence (recall contents' expand/contract states)
//4) Instance.collapsePrevious(true/false)- Sets whether previous content should be contracted when current one is expanded
//5) Instance.defaultExpanded(indices)- Sets contents that should be expanded by default (ie: 0, 1). Persistence feature overrides this setting!
//6) Instance.init() REQUIRED

var bobexample=new switchcontent("switchgroup1", "div") //Limit scanning of switch contents to just "div" elements
bobexample.setStatus('<img src="http://img242.imageshack.us/img242/5553/opencq8.png" /> ', '<img src="http://img167.imageshack.us/img167/7718/closedy2.png" /> ')
bobexample.setColor('darkred', 'black')
bobexample.collapsePrevious(true) //Only one content open at any given time

That's the part that initializes the script. See the instructions for setting up this script on the DD page.

06-19-2007, 07:27 AM
Much thanks. I feel kinda like an idiot now. =-D I guess that's what happens when you try something new at 2am!