<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Posteet: linuski</title> 
    <link>http://www.posteet.com/</link> 
    <description>Recent posteets posted to Posteet</description>
    <ttl>60</ttl>

    
    <item>
        <title>Changer une image dynamiquement</title>
        <link>http://www.posteet.com/view/431</link>
        <description>
        <![CDATA[<pre>Supposons que vous ayez dans votre page html la déclaration suivante :

&lt;object id='SvgView' data='/static/pictures/default.svg' type='image/svg+xml' width='1025' height='643'&gt;
&lt;/object&gt;


Du côté javascript, on a une fonction qui effectue le remplacement :

function displaySVG(fileName)
{
    var svgView  = document.getElementById(&quot;SvgView&quot;);
    if (svgView)
    {
        // Récupère l'adresse complète de l'ancienne image
        var  str = svgView.data.toString();
        // Cherche le nom du fichier situé aprés l'adresse du serveur :
        // on suppose que le format de str est du type  'http://192.168.122.56/pictures/truc/default.svg'
        var  pos = str.indexOf('/', 7);
        // Extraction de l'adresse du serveur
        var  url = str.substring(0, pos);
        // Remplace l'ancienne adresse par la nouvelle
        Dom.replaceObjectData(&quot;SvgView&quot;, url + fileName);
    }
}</pre> <a href="http://www.posteet.com/tags/html">[html]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a> ]]>        </description>
        <dc:creator>linuski</dc:creator>
        <pubDate>Wed, 14 Nov 2007 15:54:07 +0000</pubDate>

            <category>html</category>
            <category>javascript</category>
    
    </item>


</channel>
</rss>
