banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

#1 Wed 19 May 2010 15:20

icadedt
Participant assidu
Lieu: ici et là
Date d'inscription: 21 Jul 2006
Messages: 478

code hjavascript dans un document KML

Bonjour,


est il possible d'executer un code javascript dans un document kml?
j'ai essayé ci-dessous le code mais ca marche pas (appuyer sur un bouton pour faire alert('hello'):

Code:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
    <name>sample.kml</name>
    <Style id="yellow_paddle">
        <IconStyle>
            <Icon>
                <href>http://maps.google.com/mapfiles/kml/paddle/ylw-blank.png</href>
            </Icon>
        </IconStyle>
        <BalloonStyle>
            <text>$[description]</text>
        </BalloonStyle>
    </Style>
    <Placemark>
        <name>sample </name>
        <Snippet maxLines="0"></Snippet>
        <description><![CDATA[<!-- BalloonStyle background color:
ffffffff
 -->
<!-- Icon URL:
http://maps.google.com/mapfiles/kml/paddle/ylw-blank.png
 -->


<div style="overflow: scroll; height: 152px; width: 442px;">
    <table width="580" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="3" align="left" valign="top">
      <table width="100%" cellpadding="0" cellspacing="0">
        <tr>
          <td align="left" valign="middle">
            <img src="test kml/files/logo_2_02.png" alt="logo" />
          </td>
          <td align="left" valign="middle">
            <font color="#CC3333" size="+2"><strong>Organization Name</strong></font>
            <hr />
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td align="left" valign="top">
      <p>
        <font color="#666666"><strong>About Us:</strong></font>
        <br />
        <font color="#999999">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Donec et nisl  egestas magna commodo pharetra. Nunc ultricies augue et nulla. Morbi  porta. Aenean faucibus convallis sapien. Suspendisse odio diam, auctor  tempus, vulputate vel, venenatis sit amet, massa. Suspendisse potenti.  Nunc ac mi ut elit tempus rutrum. Suspendisse quis diam. Ut vel sapien  a justo sodales laoreet. Morbi eu augue sed ante tincidunt varius.  Suspendisse aliquam.</font>
      </p>
      <p>
        <a href="http://www.aia150.org" target="_blank"><strong><font color="#CC3333">Link 1</font></strong></a>
        <br />
        <a href="http://www.aia150.org" target="_blank"><strong><font color="#CC3333">Link 2</font></strong></a>
      </p>
    </td>
    <td width="10" align="left" valign="top">&nbsp;</td>
    <td align="right" valign="top">
      <table border="0" cellspacing="0" cellpadding="0" bgcolor="white">
        <tr>
          <td align="center">
            <img src="test kml/files/milford_sound.jpg" alt="picture" width="400" height="300" align="left" />          </td>
        </tr>
        <tr>
          <td align="left" valign="top">
            <dl>
              <dt><font color="#666666"><strong>Photo Title:</strong></font></dt>
              <dd><font color="#999999">  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Donec et nisl  egestas magna commodo pharetra. Nunc ultricies augue et nulla. Morbi  porta. Aenean faucibus convallis sapien. (photo: credit)</font></dd>
            </dl>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td colspan="3" align="right" valign="top">
      <font color="#999999">footer / copyright</font>
    </td>
  </tr>
</table>


<script type="text/javascript">
     
      function boom(){
       
        alert("hello");
      
      }
    </script>
<input id="Button1" type="button" value="button" onclick="boom()" />
 


     
</div>

]]></description>
        <LookAt>
            <longitude>-122.449601</longitude>
            <latitude>37.753406</latitude>
            <altitude>0</altitude>
            <range>24000</range>
            <tilt>0</tilt>
            <heading>0</heading>
        </LookAt>
        <styleUrl>#yellow_paddle</styleUrl>
        <gx:balloonVisibility>1</gx:balloonVisibility>
        <Point>
            <coordinates>-122.497677102,37.7656660724,0</coordinates>
        </Point>
    </Placemark>
</Document>
</kml>

Hors ligne

 

Pied de page des forums

Powered by FluxBB