language="JavaScript" solves onload in chrome

2,626 views
Skip to first unread message

Charles Cossé

unread,
Jan 9, 2012, 10:34:21 PM1/9/12
to django...@googlegroups.com
Hello,

Just writing to share a revelation -- that using:

<script language="JavaScript">

instead of

<script type="text/javascript">
 
makes it possible to use:

<body onload="init();"> 

in a template, before init() is actually defined ... i think chrome mainly didn't like the "anonymous function" init reference in my template when it was not yet defined.  Here's the template i'm talking about (head section):

<head>
    <title>{% block title %}{% endblock %}</title>
<script language="JavaScript">
{% block js %}
{% endblock %}
</script>
</head>

Hope that helps somebody down-the-line.  Over-and-out.
-Charles

snow leung

unread,
Jan 10, 2012, 10:17:56 PM1/10/12
to Django users
how about in firefox ? if the same that we can do anything about this.

if not you can u jquery method
$(function(){
//do your initrail or other.
})

jquery method was not like body onload.
Reply all
Reply to author
Forward
0 new messages