[Seaside] Re: external JavaScript
Michel Bany
m.bany at wanadoo.fr
Fri May 13 08:03:00 CEST 2005
Yanni Chiu a écrit :
>Guenther Schmidt wrote:
>
>
>>I need to insert
>>
>> <script src="http://www.xxx.com"> </script>
>>
>>How can I insert such a link?
>>
>>
>
>html attributeAt: 'src' put: 'http://www.xxx.com'.
>html tag: 'script' do: ' '.
>
>
>
Or, using a higher level api :
html attributeAt: 'src' put: 'http://www.xxx.com'.
html script: ''.
Using the higher level api will supply the type attribute, at least in
the latest versions of Seaside.
If you do not get the type attribute, you will need to patch
WAAbstractHtmlBuilder>>script:.
If you want the script element to be in the html head, you need to
implement #updateRoot:
in your component.
updateRoot: aRoot
| elem |
elem := WAHtmlElement named: 'script'.
elem attributeAt: 'type' put: 'text/javascript'.
elem attributeAt: 'src' put: 'http://www.xxx.com'.
aRoot addHeadElement: elem.
More information about the Seaside
mailing list