ChrisB: JS wird nicht ausgeführt?

Beitrag lesen

Hi,

<script src="functions.js" type="text/javascript">alert("JAVASCRIPT AUSGABE");</script>
Wenn du src und gleichzeitig einen Inhalt angibst, ist das etwas seltsam. Vielleicht wird der Inhalt da ja nicht mehr beachtet, wegen src.

So ist es.

http://www.w3.org/TR/1999/REC-html401-19991224/interact/scripts.html#h-18.2.1:
„The script may be defined within the contents of the SCRIPT element or in an external file. If the src attribute is not set, user agents must interpret the contents of the element as the script. If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI.“

Es gibt zwar ein paar obskure Workarounds dafür, aber zu empfehlen sind die eher nicht.

MfG ChrisB

--
“Whoever best describes the problem is the person most likely to solve the problem.” [Dan Roam]