Ok, mi ritrovo nella seguente situazione:
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Choose File</title>
<style type="text/css">
<!--
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
background-color: #F0F0EE;
font-size: 10px;
}
h2 {
font-size: 13px;
font-weight: bold;
}
.button {
background-color: #FEFEFE;
border: 1px solid #555555;
font-size: 9px;
height: 18px;
font-weight: bold;
}
-->
</style>
<script language="javascript" type="text/javascript">
<!--
var displayed = 0;
function fillpreview(file, tag) {
placeholder = document.getElementsByTagName('td')[1];
if (tag=='img') {
imgplaceholder = placeholder.getElementsByTagName('img')[0];
imgplaceholder.src = "/testsection/files/"+file;
imgplaceholder.style.display = "block";
}
if (tag=='object') {
if(!document.all) {
objectplaceholder = placeholder.getElementsByTagName('object')[0];
objectplaceholder.style.display = "none";
param1 = "<param name=\"quality\" value=\"high\">";
param2 = "<param name=\"movie\" value=\"/testsection/files/"+file+"\">";
embed = "<embed src=\"/testsection/files/"+file+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"100%\" height=\"100%\"></embed>";
objectplaceholder.innerHTML = param1+param2+embed;
objectplaceholder.style.display = "block";
}
else {
if (displayed == 0) {
alert("Sorry, your browser doesn't support this feature");
displayed++;
}
}
}
}
-->
</script>
</head>
<body>
<h2>Choose a file from the list below</h2>
<div align="right"><input class="button" type="button" onclick="self.close();" value="Cancel" /></div>
<form>
<table width="100%" align="left">
<tr valign="top">
<td width="50%">
<input type="radio" name="selection" value="" style="display:none " />
<input type="radio" name="selection" value="fword.swf" onclick="this.form.choice.value=this.form.selection[1].value; fillpreview(this.value,'object');" />fword.swf
<input type="radio" name="selection" value="weirdAl.swf" onclick="this.form.choice.value=this.form.selection[2].value; fillpreview(this.value,'object');" />weirdAl.swf
<input type="hidden" name="choice" />
<input style="margin-top: 10px;" class="button" type="button" value="Click when done" onclick="window.opener.document.forms[0].personal_parameters.value = '../../../testsection/files/'+this.form.choice.value; window.opener.document.forms[0].doclick.click(); self.close();" />
</td>
<td align="center">
<b style="position: relative; top: 90px; margin-bottom: 5px">Preview[/b]
<div style="position: relative; top: 100px; width: 200px; height: 200px; overflow: hidden; border: 1px solid #000000;">
<object style="display: none;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="100%">
<param name="movie" value="1.swf">
<param name="quality" value="high">
<embed src="1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="100%"></embed>
</object>
</div>
<input style="position: relative; top: 120px;" class="button" type="button" value="Click when done" onclick="window.opener.document.forms[0].personal_parameters.value = '../../../testsection/files/'+this.form.choice.value; window.opener.document.forms[0].doclick.click(); self.close();" />
</td>
</tr>
</table>
</form>
</body>
</html>
Lo script fillpreview fa il suo dovere in caso di immagini, ma mi sta facendo passare dei brutti 5 minuti per quanto riguarda object.
Posto infatti solo il caso del tag object.
La soluzione attuale, di cui vorrei disfarmi, utilizza innerHTML e funziona apparentemente solo con FF. L'altra soluzione che stavo considerando e che ho abbandonato (per mia incapacità :D credo ), prevedeva l'uso del DOM - in particolare: ripescavo tutti i nodi 'param' e 'embed' e li rimpiazzavo con i dei nuovi tag con nuovi valori di proprietà.
Purtroppo in quel modo in FireFox non funzionava più e, addirittura, in Internet Explorer andava in crash il browser al secondo tentativo di modificare il filmato. Qualche idea?