Adding a Javascript function in the head of the page

View: New views
3 Messages — Rating Filter:   Alert me  

Adding a Javascript function in the head of the page

by Andres Fortier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list,
           I'm pretty sure that this must be a silly
question, but I can't find the way to do it. I
basically need to define a javascript function in the
header of my page. Specifically I need:

<head>
...
<script type="text/javascript">

     //<![CDATA[
     function myFunction() {...}
     //]]>
     </script>
...
</head>

I've tried adding it in the #updateRoot: by doing
something like:

updateRoot: aHtmlRoot
               
                super updateRoot: aHtmlRoot.
                aHtmlRoot javascript contents: /javascript code/

but it doesn't work. So, any hints are really appreciated.

Thanks in advance,
                                Andrés
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

RE: Adding a Javascript function in the head of the page

by Boris Popov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

MyComponent>>script
  ^'function myfunction () {alert("Hello, World!")};'.

Hope this helps,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

boris@...

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: seaside-bounces@... [mailto:seaside-
> bounces@...] On Behalf Of Andres Fortier
> Sent: Friday, April 18, 2008 12:28 PM
> To: Seaside List
> Subject: [Seaside] Adding a Javascript function in the head of the page
>
> Hi list,
>            I'm pretty sure that this must be a silly
> question, but I can't find the way to do it. I
> basically need to define a javascript function in the
> header of my page. Specifically I need:
>
> <head>
> ...
> <script type="text/javascript">
>
>      //<![CDATA[
>      function myFunction() {...}
>      //]]>
>      </script>
> ...
> </head>
>
> I've tried adding it in the #updateRoot: by doing
> something like:
>
> updateRoot: aHtmlRoot
>
> super updateRoot: aHtmlRoot.
> aHtmlRoot javascript contents: /javascript code/
>
> but it doesn't work. So, any hints are really appreciated.
>
> Thanks in advance,
> Andrés
> _______________________________________________
> seaside mailing list
> seaside@...
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: Adding a Javascript function in the head of the page

by Philippe Marschall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Something like

updateRoot: aHtmlRoot

               super updateRoot: aHtmlRoot.
               aHtmlRoot javascript add: /javascript code/

should work. It's not very intuitive, sorry. In recent version of Seaside:

updateRoot: aHtmlRoot

               super updateRoot: aHtmlRoot.
               aHtmlRoot javascript with: /javascript code/

should work as well

Cheers
Philippe



2008/4/18, Andres Fortier <andres@...>:

> Hi list,
>           I'm pretty sure that this must be a silly question, but I can't
> find the way to do it. I basically need to define a javascript function in
> the header of my page. Specifically I need:
>
>  <head>
>  ...
>  <script type="text/javascript">
>
>     //<![CDATA[
>     function myFunction() {...}
>     //]]>
>     </script>
>  ...
>  </head>
>
>  I've tried adding it in the #updateRoot: by doing something like:
>
>  updateRoot: aHtmlRoot
>
>                 super updateRoot: aHtmlRoot.
>                 aHtmlRoot javascript contents: /javascript code/
>
>  but it doesn't work. So, any hints are really appreciated.
>
>  Thanks in advance,
>                                 Andrés
>  _______________________________________________
>  seaside mailing list
>  seaside@...
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside