Hi, 

I have followed the javascriptExtension example. 
I can execute the javascript when I have "Always on this page" selected
(simple alert("HELLO"); command)
  
The problem I have is executing the javascript on demand. 

Using the following code I cannot execute the javascript on demand. 

{{velocity}}$xwiki.jsx.use("<space>.<javascript Name>"){{/velocity}}

Is there anything else that I need to do? I have followed the javascript
example verbatim and tried executing the following code but no success:

{{velocity}}$xwiki.jsx.use("XWiki.MyFirstJavascriptExtension"){{/velocity}}


Any ideas?

Thanks

Riaz

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Marius Dumitru Florea
Sent: 16 November 2011 14:44
To: XWiki Developers
Subject: Re: [xwiki-devs] {{html}} tag using JavaScript

Hi Riaz,

The clean approach is to put the JavaScript code in a
JavaScriptExtension (see
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial#HMi
nimalJavaScripteXtension
) and leave only the HTML in the page content.

Hope this helps,
Marius

On Mon, Nov 14, 2011 at 1:30 PM, Riaz Shafi <[email protected]> wrote:
>
>
> Hi,
>
> I'm struggling with adding a google map to an xwiki page using javascript.
> Below is the code I'm using which does not work. It's not easy to see
where
> the problem is.
>
> {{html clean="false" wiki="false"}}
>
> <script type="text/javascript"
> src="http://maps.google.com/maps/api/js?sensor=false";></script>
> <script type="text/javascript" id="script">
> var tableid = 297050;
> var map;
>
> function initialize() {
>    map = new google.maps.Map(document.getElementById('map_canvas'), {
>    center: new google.maps.LatLng(37.4, -122.1),
>    zoom: 10,
>    mapTypeId: google.maps.MapTypeId.ROADMAP
>  });
>
>  var layer = new google.maps.FusionTablesLayer({
>    query: {
>      select: 'Address',
>      from: tableid
>    },
>    map: map
>  });
> }
> </script>
> <script>
> window.onload=initialize();
>
>
> </script>
>
>
> HELLO
> <table><tr><td width="400" height="400">
>    <div id="map_canvas" style="width:100%; height:100%"></div>
>  </td></tr></table>
>
>
> {{/html}}
>
> The page can be viewed Today (14/11/2011) on
> http://playground.xwiki.org/xwiki/bin/view/Test/MapJavaScript
> Username: guest password guest123
>
> The html page I am trying to display is shown here:
>
http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/fusiontableslayer
> _example.html
>
>
> Any help is much appreciated.
>
> Thanks
>
> Riaz
>
>
>
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to