Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 761321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:49:25+00:00 2026-05-14T15:49:25+00:00

I am building my portfolio website simply using HTML , Flash , and the

  • 0

I am building my portfolio website simply using HTML, Flash, and the Mootools Javascript framework. I have decided to implement a theme changing feature using Javascript and cookies. When the user clicks on the “Change Theme” link, a mediaboxAdvanced lightbox appears, containing a real-time form which allows you to change the theme on the portfolio.

Here’s the code for the form:

<div id="mb_inline" style="display: none; margin:15px;">
    <h3>Change Your Theme</h3>
    <form>
        <fieldset>
            <select id="background_color" name="background_color">
                <option  value="#dcf589">Original</option>
                <option value="#000FFF">Blue</option>
                <option value="#00FF00">Green</option>
            </select>
        </fieldset>
    </form>
</div>

I know, there is no submit button, but as soon as something is changed in that form, the following Mootools code happens:

var themeChanger = new Class(
{
    pageBody : null,

    themeOptions : null,

    initialize: function()
{
    this.pageBody = $(document.body);
    this.themeOptions = $('background_color');
    this.themeOptions.addEvent('change', this.change_theme.bindWithEvent(this));
},

change_theme: function(event)
{
    alert("Hello");
}
});

window.addEvent('domready', function() {
    var themeChanger_class = new themeChanger();
});

Now this is only a test function, which should be triggered when the dropdown menu changes. However, it seems that none of it works when the form is in the lightbox! Now if I decide to run the form outside of the lightbox, then it works great!

It seems it can’t even access the “background_color” element.

Am I missing something?

If you need more examples, I will fill in on demand.

Thank you all in advance.

-Christopher

Update (4/27/2010 – 12:54PM):


I looked into this a little more and have two theories about all of this.

1- In the mediaboxAdv.js file, there’s the following declaration:

$(document.body).adopt(

Could this keep me from accessing the body’s properties, such as “background-color”?

2- Could the lightbox display that form as a page on its own, hence why I cannot access the parent page’s body tag?

3- Do I need to declare my javascript file the following way?

<div id="mb_inline" style="display: none; margin:15px;">
<!-- script declaration -->
<script type="text/Javascript" src="scripts/themeChanger.js"></script>
<!-- the form -->
<h3>Change Your Theme</h3>
<form>
    <fieldset>
        <select id="background_color" name="background_color">
            <option  value="#dcf589">Original</option>
            <option value="#000FFF">Blue</option>
            <option value="#00FF00">Green</option>
        </select>
    </fieldset>
</form>
</div>

Update (4/27/2010 – 1:17PM):

Here’s a screenshot of what I am trying to do, if it can help you guys.

alt text

Chances are I might post a link to the site so that you can see with your own eyes what I want to do.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:49:26+00:00Added an answer on May 14, 2026 at 3:49 pm

    This is a modal window. running code on DOMREADY here is pretty pointless. There is no DOMREADY when you put some HTML into a div. I assume there’s an onComplete event being fired by the lightbox/mediabox plugin that you can hook into and use it to instantiate your themeChanger

    Not seen the specifics of the plugin that you use but in pseudo code…

    new mediaBox({
        width: nnn,
        height: nnn,
        title: "Change your theme",
        text: "your mark-up",
        onComplete: function() {
            new themeChanger(); // will set the listener which will work with the mark-up.
        }
    
    });
    

    if the content of the window is being loaded through Request.HTML or whatever other method, you should also get an onComplete event you can plug into.

    I hope this makes sense, good luck

    edit i stand corrected – this is not even a class but a function-based plugin (http://iaian7.com/files/webcode/mediaboxAdv/mediaboxAdv-1.2.0.js) that uses element prototypes… it does not look as if it has support for events on content loaded. furthermore, it supports just 1 method that is suitable of supplying content in your case, inline which relies on the modal content already being hidden within the DOM. perhaps this is the source of your problem – if you look at http://iaian7.com/webcode/mediaboxAdvanced#inline – the hidden content is copied through the innerHTML, it uses just preload = $(URLsplit[1]).get('html'); and then in the startEffect function sets the contents of the modal window to the value of preload. this technique WON’T clone the events you may have done but just the HTML-events in mootools are in element storage and as such, tied to element UID.

    Perhaps you can modify the script to add a new option, like onComplete: $empty() that you can call from within the startEffect function once it has finished animating and has added in the content.

    good luck again. the best advice i can give you here – do not use this plugin for dialogue windows, its overkill and its not modular enough – such a shame because mootools could have been put to a great use here, it’s not just a tool for DOM manipulation 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building on How Do You Express Binary Literals in Python , I was thinking
Building a client-side swing application what should be notified on a bus (application-wide message
Building the same project (without any changes) produces binary different exe-files: some small regions
Building on what has been written in SO question Best Singleton Implementation In Java
When building a VS 2008 solution with 19 projects I sometimes get: The GenerateResource
When building projects in C++, I've found debugging linking errors to be tricky, especially
When building some of my PHP apps, a lot of the functionality could be
Im building a web application which is a process management app. Several different employee
When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant
In building an ASP.NET 3.5 WAP, I'm always frustrated by the feeling that no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.