[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[TYPO3-english] Javascript in HTML template



I have a problem regarding a Javascript in my html template.

When I run the template on my local pc it works, but when loading the template on my typo3 site there is an error.
The javascript is the following (it just insert a random picture into a <td>

<script type="text/javascript">
var aryimages = new Array('banner2.jpg');
document.getElementById("someimage").src = aryimages[Math.floor(Math.random() * aryimages.length)];
</script>

</HEAD>

<body>

<div align="center">
<table border="0" style="border: 1px solid #319a63" width="956" cellspacing="0" cellpadding="0" height="660">
                <tr>
<td valign="bottom" width="956" height="153" id="menu" colspan="3"><img id="someimage" src="">menu</td>
                </tr>


When opening the page in typo3 I can see an explorer error, that calls the following error:
'document.getElementById(...)' is null or not an object

- and it points to the line "document.getElementById("someimage").src = aryimages[Math.floor(Math.random() * aryimages.length)];"
Anyone has knowledge about problem with inserting javascript ? as it seems 
to be an typo3 related error, as it works fine on my local pc.
Regards
Cecilie
_______________________________________________
TYPO3-english mailing list
[email protected]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english