How to toggle skinned images client side?

Last post 11-29-2005 7:50 PM by garymon. 1 replies.

Sort Posts:

  • How to toggle skinned images client side?

    11-29-2005, 5:38 PM
    • Member
      87 point Member
    • garymon
    • Member since 11-12-2005, 11:36 PM
    • Posts 22
    I have a user control that displays some data and emits Javascript to do client side expansion/contraction of the control.
    The user control has been skinned except I am having trouble figuring out how to skin the image that is clicked to expand/contract the control. It needs to toggle between 2 images ("+" and "-" for example.). I would like each theme to be able to decide what the two images will be. Basically I need to get both URLs based on theme when I am generating the toggle Javascript in the controls code behind page. Any ideas?

    Thank you,
    Gary
  • Re: How to toggle skinned images client side?

    11-29-2005, 7:50 PM
    • Member
      87 point Member
    • garymon
    • Member since 11-12-2005, 11:36 PM
    • Posts 22
    Well I worked out a solution. I don't know if it is the best all around solution, but it works for my needs.

    In the scriptBlock where I register my toggle function, I added the following:

    scriptString += "var minImage = new Image(); \n";
    scriptString +=
    "minImage.src = \"../App_Themes/" + Page.Theme + "/images/Minimize.gif\"; \n";
    scriptString +=
    "var maxImage = new Image(); \n";
    scriptString +=
    "maxImage.src = \"../App_Themes/" + Page.Theme + "/images/Restore.gif\"; \n";

    As long as each theme has 2 files with these names, I'm golden.

    -Gary

Page 1 of 1 (2 items)