[TYPO3] plain HTML doesn't allow javascript?
dieter orens
reddesertvandriver at gmail.com
Sat Jan 28 00:20:59 CET 2006
well the main purpose is to have a simple style switcher. I use a simple
javascript function, and onclick - events. Everything works great, but
once in Typo3, nothing happens. I'm probably very stupid, so if you can
get this to work I would be very thankful.
Put this in the head:
<link href="default.css" rel="stylesheet" type="text/css" >
<link href="dark.css" rel="alternate stylesheet" type="text/css"
title="dark">
<link href="light.css" rel="alternate stylesheet" type="text/css"
title="light">
and this as plain html content element:
<script>
function setStyleSheet(title) {
var i;
var a = document.getElementsByTagName("link");
for(i=0; i <a.length; i++) {
if(a[i].getAttribute("rel").indexOf("style") != -1 &&
a[i].getAttribute("title")) {
a[i].disabled = true;
if(a[i].getAttribute("title") == title) a[i].disabled = false;
}
}
}
</script>
<a href="javascript:;" onclick="setStyleSheet('light'); return
false;">light</a>
<a href="javascript:;" onclick="setStyleSheet('dark'); return
false;">dark</a>
Christopher schreef:
> Hi,
>
> On 1/27/06, dieter orens <reddesertvandriver at gmail.com> wrote:
> <snip>
>
>>The function and everything works though, if you test it without typo3.
>>Maybe typo3 doesn't allow changing stylesheets?
>>
>
>
> Ridiculous. Are you really expecting help?
>
> So far, you haven't provided enough information to get any kind of
> useful responses. If you really want help, give us something to go on.
>
> You say it works without Typo3, but not with Typo3. Well, what would
> you do if Typo3 were not involved and you had a problem with a web
> page? You'd LOOK AT THE SOURCE and find out what was wrong.
>
> Say what you expect to happen and say what's actually happening--with
> some relevant details--or you're just going to be wasting your own
> time and everyone else's too.
>
>
> -Christopher
More information about the TYPO3-english
mailing list