You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by sw...@krypthonas.de on 2007/09/15 12:13:36 UTC

Javascript Source File can not be directly loaded

Hi there,
i´ve since a few days much more problems with Javascript and Cocoon then ever...

When I trying to read a local or remote Javascript Sourcefile in my XSL Context to use them on client side for particular dutys, i getting only a screen with my html elements without my logical part of Javascript.

My Reader is orderly registered and read the whole Javascript File as well. I getting no one produced Error to my logfiles in this time.

Example(in this case there is in test.js a function named "test" and within of them an alert invocation ):

<xsl:template match="body">

<body>
 <script src="test/test.js" language="Javascript"/>
 <script>test();</script> 
</body>

...

There happens nothing. Also an separately invocation of the alert function brings no result to my eyes...

Such like this:

<xsl:template match="body">

<body>
 <script src="test/test.js" language="Javascript"/>
 <script>alert("Testing an JavaScript Function Call ...");</script> 
</body>

...

But now....

After i deleted the include tag for the Javascript file, my alert Box appears correctly.

<xsl:template match="body">

<body>
 <script>alert("Testing an JavaScript Function Call ...");</script> 
</body>

...


What could it be?

Best Regards
Sebastian Wenzky

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript Source File can not be directly loaded

Posted by Jason Johnston <co...@lojjic.net>.
Felix Knecht wrote:
> swenzky@krypthonas.de schrieb:
>> Hi there, i´ve since a few days much more problems with Javascript 
>> and Cocoon then ever...
...
>> 
>> Example(in this case there is in test.js a function named "test" 
>> and within of them an alert invocation ):
>> 
>> <xsl:template match="body">
>> 
>> <body> <script src="test/test.js" language="Javascript"/> 
>> <script>test();</script> </body>
> 
> I had simular problems. What helped in my case was to have a starting
>  and ending tag for script like
> 
> <body> <script src="test/test.js" language="Javascript"> <!-- Dummy 
> text --> </script> <script>test();</script> </body>

Yes, that's exactly it; Internet Explorer in particular will ignore
everything after a <script> tag if it is not closed with a </script>
tag.  Using the XML-style closing <script/> will not work.
http://www.phpied.com/ie-script-tag-problem/

Please note this has nothing to do with Cocoon in particular but is
simply a browser issue.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript Source File can not be directly loaded

Posted by Felix Knecht <fe...@apache.org>.
swenzky@krypthonas.de schrieb:
> Hi there,
> i´ve since a few days much more problems with Javascript and Cocoon then ever...
> 
> When I trying to read a local or remote Javascript Sourcefile in my XSL Context to use them on client side for particular dutys, i getting only a screen with my html elements without my logical part of Javascript.
> 
> My Reader is orderly registered and read the whole Javascript File as well. I getting no one produced Error to my logfiles in this time.
> 
> Example(in this case there is in test.js a function named "test" and within of them an alert invocation ):
> 
> <xsl:template match="body">
> 
> <body>
>  <script src="test/test.js" language="Javascript"/>
>  <script>test();</script> 
> </body>

I had simular problems. What helped in my case was to have a starting
and ending tag for script like

<body>
 <script src="test/test.js" language="Javascript">
  <!-- Dummy text -->
 </script>
 <script>test();</script>
</body>

Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript Source File can not be directly loaded

Posted by Dev at weitling <de...@weitling.net>.
Hi Sebastian,

as Felix & Co. have pointed out, this is a problem with IE, but it may
occur with Firefox in some special cases, too. At least when you're
using unholy JSP documents.
Having two lines in server-side HTML code:
    1   <script type="text/javascript" src="tools.js"/>
    2   <script type="text/javascript">do something</script>
then the second line wasn't called or available. Following
solved/worked-around my problem:
    1   <script type="text/javascript" src="tools.js">return void;</script>

Weird, but...

Bye,
Florian


swenzky@krypthonas.de wrote:
> Hi there,
> i´ve since a few days much more problems with Javascript and Cocoon then ever...
>
> When I trying to read a local or remote Javascript Sourcefile in my XSL Context to use them on client side for particular dutys, i getting only a screen with my html elements without my logical part of Javascript.
>
> My Reader is orderly registered and read the whole Javascript File as well. I getting no one produced Error to my logfiles in this time.
>
> Example(in this case there is in test.js a function named "test" and within of them an alert invocation ):
>
> <xsl:template match="body">
>
> <body>
>  <script src="test/test.js" language="Javascript"/>
>  <script>test();</script> 
> </body>
>
> ...
>
> There happens nothing. Also an separately invocation of the alert function brings no result to my eyes...
>
> Such like this:
>
> <xsl:template match="body">
>
> <body>
>  <script src="test/test.js" language="Javascript"/>
>  <script>alert("Testing an JavaScript Function Call ...");</script> 
> </body>
>
> ...
>
> But now....
>
> After i deleted the include tag for the Javascript file, my alert Box appears correctly.
>
> <xsl:template match="body">
>
> <body>
>  <script>alert("Testing an JavaScript Function Call ...");</script> 
> </body>
>
> ...
>
>
> What could it be?
>
> Best Regards
> Sebastian Wenzky
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Javascript Source File can not be directly loaded

Posted by Felix Knecht <fe...@otego.com>.
swenzky@krypthonas.de schrieb:
> Hi there,
> i´ve since a few days much more problems with Javascript and Cocoon then ever...
> 
> When I trying to read a local or remote Javascript Sourcefile in my XSL Context to use them on client side for particular dutys, i getting only a screen with my html elements without my logical part of Javascript.
> 
> My Reader is orderly registered and read the whole Javascript File as well. I getting no one produced Error to my logfiles in this time.
> 
> Example(in this case there is in test.js a function named "test" and within of them an alert invocation ):
> 
> <xsl:template match="body">
> 
> <body>
>  <script src="test/test.js" language="Javascript"/>
>  <script>test();</script> 
> </body>
> 

I had simular problems. What helped in my case was to have a starting
and ending tag for script like

<body>
 <script src="test/test.js" language="Javascript">
  <!-- Dummy text -->
 </script>
 <script>test();</script>
</body>

Felix


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org