Hi, <br><br>I need to change WMS layers f(time). To change the time I use the mergeNewElement function: <br> update_date= function update_date()<br> { <br>
var string = OpenLayers.Util.getElement('year').value + "-" + // ss entendu que get element by id (year= id ds ce cas).<br> OpenLayers.Util.getElement('month').value + "-" +<br>
OpenLayers.Util.getElement('day').value + "T" +<br> OpenLayers.Util.getElement('hour').value + ":" +<br>
OpenLayers.Util.getElement('minute').value + ":00";<br> wms1.mergeNewParams({'time':string});<br> wms2.mergeNewParams({'time':string}); }<br>
<br>This function is related with an onchange event in the html part: <br> <input size="4" type='text' id='year' value="2005" onchange="update_date()"/>-<input size="2" type="text" id="month" value="08" onchange="update_date()"/><br>
... etc<br><br>It works but the problem is that I need to put the wms layers in different maps. So if I change the time, only the last wms (in the last map created) changes and I need to change all the wms at the same time.<br>
To create the maps and to add the wms, I use this script:<br><br>function createmap_S()<br> {<br> <br> var imap= -1;<br> var createmap_B= function()<br> {<br> imap= imap+1;<br>
$('body').append('<div class="map" id="id_map'+imap+'"></div>');<br> $('body').append('<script type="text/javascript">createmap("'+imap+'");<\/script>');// Revoir utilisation des guillemets. <\/script>' = ??? <br>
}<br> return createmap_B;<br> }<br> $("#boutton_createmap").click(createmap_S());<br> $("#boutton_removemap").click(function() {$(".map:last").remove();}); <br>
<br>/////// ADD WMS TO GLOBAL MAP: //////////////<br> $("#modele1").click(function() {mapelement.addLayer(wms1);});<br> $("#modele2").click(function() {mapelement.addLayer(wms2);});<br>
<br>So my question is: how can I do to apply each change of time to each wms present on the screen (i can have 1, 2, 3...). I tried to use JQuery: $('.olLayerGrid').mergeNewParams but it doesn't work (if I use $('.olLayerGrid').remove(); it works: it removes all the wms layers but remove() is a jquery function too! <br>
Any suggestions?<br>Thanks a lot, <br><br>Pascal.<br><br>