Mateusz Viste a écrit :
Quote:
В Суббота 06 сентября 2008 16:55, SAM писал:
Quote:
>in your code 'document' is the document of the window which has the
>script and not the document of your new window.
>
Hi,
>
Thank you a lot for your comments!
About the main issue: indeed, you are right :-) I just
replaced "document.write" by "newwindow.document.write", and it works
fine :-)
Don't forget to add at end of your writting :
newwindow.document.close();
If not, my Fx never stops to wait the end of document.
Quote:
I would have a secondary question (still about the same script). I am
triggering my script using a button:
<form><input type="button" value="Play" onClick="playmedia()"></form>
<form action="javascript
:playmedia()">
<input type="submit" value="Play">
</form>
Quote:
Is there any way I could do that using a link?
<a href="errorJS.htm"
onclick="playmedia(); return false;">Play</a>
To play sound with 'embed' in same page (same window) :
<html>
<script type="text/javascript">
function playmedia(title) {
var E = document.createElement('embed');
E.src = title.href;
E.hidden = false;
E.controller = true;
E.autostart = true;
E.loop = 1;
E.autosize = 1;
if(document.getElementById('player'))
document.getElementById('player').parentNode.repla ceChild(
E, document.getElementById('player'));
else
document.body.appendChild(E);
E.id = 'player';
return false;
}
</script>
<h2>Play sounds</h2>
<ul>
<li><a href="sound1.mid" target="play"
onclick="return playmedia(this)">sound 1</a></li>
<li><a href="sound2.mid" target="play"
onclick="return playmedia(this)">sound 2</a></li>
<li><a href="sound3.mid" target="play"
onclick="return playmedia(this)">sound 3</a></li>
</ul>
</html>
Embed it deprecated !
--
sm