Anonymous

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromAnonymous
ToMe
SubjectStylesheet switcher - probably more complicated than the usual questions.
Date3 July 2007 30:02
Hi Mark

I am coming to the end of the third iteration in five years of a web site
development I am doing for one of my clients - an [business] basically. This
time round it has got a bit more challenging.

I have utilised you style switcher code to endeavour to build a site for
visually handicapped [users] ( there aren't
may of them but maybe when everyone has cottoned on to what we are doing, in
a couple of years there may be a few more)  and it works great. The
challenge I have is to make it work with inline frames.

You can see the site at [URL] - one of my development
domain names that I use.

There are two big buttons at the top of the page at present - Colour and
Mono - self explanatory - and the centre section of the page is an inline
frame called I2. If you click mono it all goes mono but of course I2 doesn't
refresh unless you do a page refresh. You will see that I have done a quick
and dirty on the colour button which makes the whole page reload onMouseOut
- but it obviously isn't the answer.

The question I have is would you like to mod your changeStyle( ) function to
refresh I2 and possibly I3 which I have another application running in?

I'll be happy to recompense you as appropriate if that's OK with you.

I'll be sticking a links page in for credits in due course and I have a
deadline on this of next Monday - which isn't super critical - I can live
with my quick and dirty because they still have material they need to
provide me with bfeore this can go live and as you'll see I still have a lot
of loose ends to tidy up. I've left this to the last because I've had a lot
of other things to sort out.

I don't want to start tinkering with your code - I don't think its ethical -
not without asking anyway.

If you can help please let me know asap.

Many thanks

Anonymous
FromMe
ToAnonymous
SubjectRe: Stylesheet switcher - probably more complicated than the usual questions.
Date4 July 2007 10:15
Anonumous,

> The challenge I have is to make it work with inline frames.

This is fairly easy.

1. make sure all pages that are in iframes and need to change styles contain
my stylesheet switcher script, and all use the same titles for their
stylesheets

2. change the style for the main page

3. step into each iframe that needs it, and change the styles there as well

<script type="text/javascript">
function changeStyleNested(oStyle) {
  changeStyle(oStyle);
  for( var i = 0; i < window.frames.length; i++ ) {
    try { window.frames[i].window.changeStyle(oStyle); } catch(e) {}
  }
  //store here instead of onunload, to allow for iframe navigation
  rememberStyle('styleTestStore');
}
</script>

<img ... onClick="changeStyleNested('Mono')" ...>

This is designed for only a single stylesheet name being applied at any
time, which is consistent with your current use. If you decide to use more
than one style name at a time (changeStyle('foo','bar')) you will need to
alter changeStyleNested as appropriate.

While on the subject of accessibility, it is better to apply the onclick
event handler to a link instead of an image, since it will then also work
with the keyboard (most browsers cannot focus images with a keyboard, but
they can focus links).

As a final point, my license terms require you to leave my comments in the
source code of the script. Please put them back :)
http://www.howtocreate.co.uk/jslibs/termsOfUse.html


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromAnonymous
ToMe
SubjectRe: Stylesheet switcher - probably more complicated than the usual questions.
Date4 July 2007 10:57
Thanks Mark/Tarquin

I'll have a crack at it!

I'll put your comments back -  only removed them temporarily so I didn't
have so much text in my face when I was working out how it worked with half
a dozen windows open for [brand] etc. [...]

I really appreciate your comments and I am pleasantly surprised to hear back
from you so quickly. [...]

Thanks again, I am very grateful,

Anonymous,
FromAnonymous
ToMe
SubjectRe: Stylesheet switcher - probably more complicated than the usual questions.
Date4 July 2007 14:47
Hi Tarquin

Well, it all works brilliantly. I wish I understood why but no doubt after
another couple of months studying the euphemistically titled [book] and
[book2] I'll figure it out.

[Ed. of course, I also have my own JavaScript tutorial ...]

I've put the text back in and I'll do a credit and a link before I finish.

I really do appreciate your help. People like you make the world a better
place.

Now I'm off to my next adventure - I3 which isn't linked to a stylesheet -
not yet anyway!

Many thanks

Anonymous
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.