[Typo3-dev] Javascript Code in external .js-file

Esan magic at senvita.de
Mon May 10 17:26:36 CEST 2004


Hi list,

i posted this question in the regular list. One member gave me the advice to put it in the
dev list maybe you guys could take a look at it.

I have a little questeion about TYPO3.5 an handling javascript code.
Im currently using a rollover image for a regular TMENU. like this:

temp.menu_2.1 = TMENU
temp.menu_2.1 {

NO {
beforeWrap (
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><img src="{$spacer}" height="10" width="10"></td></tr>
<tr><td>|</td>
)
linkWrap = <td width="120"><div class="menu1-level2-no">|</div></td></tr></table>
beforeImg = {$imgpath}/spacer29.gif
beforeROImg = {$imgpath}/ro_menue.gif
RO = 1
}

The code itself wokrs fine. But in every page TYPO3 creates javascript code like this:

<script>
<!--
if (version == "n3") {
img90_93a4_0before_n=new Image(); img90_93a4_0before_n.src = "fileadmin/template/main/images/spacer29.gif"; img90_93a4_0before_h=new Image(); img90_93a4_0before_h.src = "fileadmin/template/main/images/ro_menue.gif"; img147_93a4_1before_n=new Image(); img147_93a4_1before_n.src = "fileadmin/template/main/images/spacer29.gif"; img147_93a4_1before_h=new Image(); img147_93a4_1before_h.src = "fileadmin/template/main/images/ro_menue.gif"; img88_93a4_3before_n=new Image(); img88_93a4_3before_n.src = "fileadmin/template/main/images/spacer29.gif"; img88_93a4_3before_h=new Image(); img88_93a4_3before_h.src = "fileadmin/template/main/images/ro_menue.gif";
}
// -->
</script>
.
.
.

<script>
<!--
function over(name,imgObj) {
if (version == "n3" && document[name]) {document[name].src = eval(name+"_h.src");}
else if (imgObj) {imgObj.src = eval(name+"_h.src");}
}
function out(name,imgObj) {
if (version == "n3" && document[name]) {document[name].src = eval(name+"_n.src");}
else if (imgObj) {imgObj.src = eval(name+"_n.src");}
}

// -->
</script>


I don't like this very much. This code is the same for all pages, so I would rather have it
locateted in on single .js-file. What Typo just has to do then is inserting a link to the .js-file,
instead of all this code every time.

Eg.

<script language="JavaScript" src="/rolloverStuff.js"></script>


Is there a chance to tell TYPO to create a separate js-File where rollover descriptions
can go to?

Thanks for your suggestions.

Regards
- Esan (esanakoko)

-----------------------
The mailing list archive is found here:
http://typo3.org/documentation/mailing-lists/dev-list-archive/
				





More information about the TYPO3-dev mailing list