Share » Forums » Suggestions » Javascript For Datatypes In <head>

Javascript For Datatypes In <head>

Javascript For Datatypes In <head>

Monday 23 June 2003 8:11:13 am - 4 replies

Modified on Monday 23 June 2003 2:02:01 pm by Douglas Hammond

Author Message

Gabriel Ambuehl

Monday 23 June 2003 1:05:17 pm

I duly second this request.

Visit http://triligon.org

Bruce Morrison

Monday 23 June 2003 3:49:46 pm

How about something like

<head>
<script language="JavaScript" src={concat("script/class_",$DesignKeys:used.class,".js")|ezdesign} type="text/JavaScript"></script>
</head>

And you would need to have a javascript file for each class id.

Cheers
Bruce
designIT

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Sven Ryen

Monday 23 June 2003 11:55:50 pm

FWIW, scripts tag can be included anywhere on the page, not just within head tags. I include the javascript src tag at the top of the edit.tpl files of my datatypes.

For onload, how about this snippet:

<script type="text/javascript" language="Javascript">
<!--
document.body.onload = function() { alert('hello world'); }
//-->
</script>

Sven Ryen

Tuesday 24 June 2003 12:12:03 am

As for your request to _append_ to the onload function, this code, although weird, will do the trick:

<script type="text/javascript" language="Javascript">
<!--
onloadtext = "alert('1');";
//-->
</script>

<script type="text/javascript" language="Javascript">
<!--
onloadtext += "alert('2');";
//-->
</script>

<script type="text/javascript" language="Javascript">
<!--
eval("document.body.onload = function() { "+onloadtext+" }");
//-->
</script>

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu