[Chameleon] maptipsClick
Julien-Samuel Lacroix
jlacroix at mapgears.com
Wed Jan 31 10:07:59 EST 2007
Hi,
I don't know if you still have the problem, but your maptipsClick
function doesn't do anything...
> ( 'MapTipsLayer', '<a href="'+att_values[1]+'"
target="_blank">'+att_values[1]+'</a>');
If you want to open a new window, then you should have:
window.open('maptips', 'test.php?value='+att_values[1]);
And then your test.php can deal with the value in the URL.
Does it makes sense to you?
Julien
Alessandro Oggioni wrote:
> Hi all,
>
> I have a problem whit a maptipsClick.
>
> The tag whit I use it’s:
>
> <cwc2 type="MapTips" link="true" visible="false"
> defaulttext=" " tolerance="8" maptipsdiv="ttt" label="Map Tips"
> styleresource="TextButtons" popupstyleresource="TextButtons"
> popupwidth="200" popupheight="150" image="images/icon_maptips.png"
> layer="Lake" onmouseover="maptipsOver" onmouseout="maptipsOut"
> onclick="maptipsClick" attributes="ELEMENTI,LINK">
>
> <image state="normal"/>
>
> <image state="selected"/>
>
> <image state="hover"/>
>
> </cwc2>
>
>
>
> and the javascript
>
> <script type="text/javascript">
>
>
>
> // Detect if the browser is IE or not.
>
> // If it is not IE, we assume that the browser is NS.
>
> var IE = document.all?true:false
>
>
>
> // Variables to hold mouse x-y
>
> var mouseX = 0;
>
> var mouseY = 0;
>
>
>
>
>
> function getMouseXY(e) {
>
>
>
> if (IE) { // grab the x-y pos.s if browser is IE
>
> mouseX = event.clientX + document.body.scrollLeft;
>
> mouseY = event.clientY + document.body.scrollTop;
>
> } else { // grab the x-y pos.s if browser is NS
>
> mouseX = e.pageX;
>
> mouseY = e.pageY;
>
> }
>
> // catch possible negative values in NS4
>
> if (mouseX < 0){mouseX = 0;}
>
> if (mouseY < 0){mouseY = 0;}
>
>
>
> // return
>
> return true;
>
> }
>
>
>
> function maptipsClick(e, att_values, att_names)
>
> {
>
> // add code here to popup a window to show the link
>
> ( 'MapTipsLayer', '<a href="'+att_values[1]+'"
> target="_blank">'+att_values[1]+'</a>');
>
> }
>
>
>
>
>
> function maptipsOver(e, att_values, att_names)
>
> {
>
>
>
> // get the mouse xy
>
> getMouseXY(e);
>
>
>
> // position the map tip
>
> CWCDHTML_SetLayerZOrder( 'MapTipsLayer', 999 );
>
> CWCDHTML_SetLayerPos('MapTipsLayer', (mouseX + 10), (mouseY + 10));
>
>
>
> // set the contents
>
> CWCDHTML_ShowContents( 'MapTipsLayer',
>
> '<div
> style="background-color: #FF0000; font-family:verdana; font-size:10px;
> width: 148; height: 1">'+
>
> '<p ALIGN="center">'+
>
>
> '<b>'+"Toponimo Lago"+'</b>'+
>
> '</p>'+
>
> '</div>'+
>
> '<div
> style="font-family:verdana; font-size:10px; width: 148; height: 1">'+
>
> '<p ALIGN="center">'+att_values[0]+'</p>'+
>
> '</div>'
>
> );
>
>
>
> // show the tip
>
> CWCDHTML_ShowLayer( 'MapTipsLayer');
>
> }
>
>
>
> function maptipsOut( e, att_values, att_names)
>
> {
>
> // hide the tip
>
> CWCDHTML_HideLayer( 'MapTipsLayer' );
>
> }
>
> </script>
>
>
>
> In particular maptipsClick.
>
>
>
> function maptipsClick(e, att_values, att_names)
>
> {
>
> // add code here to popup a window to show the link
>
> ( 'MapTipsLayer', '<a href="'+att_values[1]+'"
> target="_blank">'+att_values[1]+'</a>');
>
> }
>
>
>
> Where is the problem? I hope that anyone can I help me.
>
>
>
> Thank you
>
>
>
> Alessandro Oggioni
>
>
>
> Dr. Alessandro Oggioni - PhD (Ecology)
> CNR Institute of Ecosystem Study (ISE)
> L.go Tonolli 50-52
> I - 28922 Verbania Pallanza
> Tel.: +39 0323 518300
> Fax: +39 0323 556513
> e-mail: a.oggioni at ise.cnr.it <mailto:a.oggioni at ise.cnr.it>
>
> msm: aleoggi at libero.it <mailto:aleoggi at libero.it>
>
> skype: alessandro0974
> wwwISE: http://www.iii.to.cnr.it
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
--
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/
More information about the Chameleon
mailing list