By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,025 Members | 2,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,025 IT Pros & Developers. It's quick & easy.

how to dynamically set content of iframe?

P: n/a
Hello,
In line 8 below, I am trying to set the content of the iframe, but
receive an error.
Movie 2 plays normally.
Movie 1 fails.
This example is from the QuickTime docs. (example
1-4)http://developer.apple.com/documenta...ipt/index.html
Does anyone know what might be the problem?
thanks,
Anil
---------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Simple QuickTime Movie Controls</title>
<script language="JavaScript"/* define function that calls
QuickTime's "Play" method */ function PlayIt(anObj) { anObj.Play(); }
/* define function that calls QuickTime's "Stop" method */ function
StopIt(anObj) { anObj.Stop(); } function GeneratePlayer() {
alert("in \"GeneratePlayer()\"");
window.frames['testIframe'].innerHTML = "<object
classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\"
codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" id=\"movie1\"
height=\"160\" width=\"180\"<param name=\"src\" value=\"C:\Program
Files\QuickTime\Sample.mov\"<embed src=\"C:\Program
Files\QuickTime\Sample.mov\" type=\"video/quicktime\"
pluginspage=\"www.apple.com/quicktime/download\" name=\"movie1\"
enablejavascript=\"true\" height=\"160\" width=\"180\"></object>";
}
</script>
</head>
<body>
<pThis page uses JavaScript to control a QuickTime movie... </p>
<div align="center">
<table>
<tbody>
<tr>
<td width="200"<iframe id="testIframe"
name="testIframe"></iframe<a
href="javascript:GeneratePlayer();">GeneratePlayer ()</a><br>
<pMovie1 </p>
</td>
<td width="200"<object
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
id="movie2" height="160" width="180"<param
name="src" value="C:\Program Files\QuickTime\Sample.mov">
<embed src="C:%5CProgram%20Files%5CQuickTime%5CSample.mov "
type="video/quicktime"
pluginspage="www.apple.com/quicktime/download" name="movie2"
enablejavascript="true" height="160" width="180"></object>
<pMovie2 </p>
</td>
</tr>
</tbody>
</table>
</div>
<p>Pass movie name as a parameter to JavaScript functions defined
locally: <br>
<a href="javascript:PlayIt(document.movie1);">PlayIt( movie1)</a><br>
<a href="javascript:StopIt(document.movie1);">StopIt( movie1)</a><br>
<a href="javascript:PlayIt(document.movie2);">PlayIt( movie2)</a><br>
<a href="javascript:StopIt(document.movie2);">StopIt( movie2)</a><br>
</p>
<p>Control movie by name directly: <br>
<a href="javascript:document.movie1.Play();">movie1.P lay()</a><br>
<a href="javascript:document.movie1.Stop();">movie1.S top()</a><br>
<a href="javascript:document.movie2.Play();">movie2.P lay()</a><br>
<a href="javascript:document.movie2.Stop();">movie2.S top()</a><br>
</p>
<p>Replace a movie by name directly: <br>
<a
href="javascript:document.movie1.SetURL('MyOther.m ov');">movie1.SetURL(MyOther.mov)</a><br>
<a
href="javascript:document.movie1.SetURL('My.mov'); ">movie1.SetURL(My.mov)</a><br>
<a
href="javascript:document.movie2.SetURL('MyOther.m ov');">movie2.SetURL(MyOther.mov)</a><br>
<a
href="javascript:document.movie2.SetURL('My.mov'); ">movie2.SetURL(My.mov)</a><br>
</p>
</body>
</html>

Jan 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
no replies?

Anil wrote:
Hello,
In line 8 below, I am trying to set the content of the iframe, but
receive an error.
Movie 2 plays normally.
Movie 1 fails.
This example is from the QuickTime docs. (example
1-4)http://developer.apple.com/documenta...ipt/index.html
Does anyone know what might be the problem?
thanks,
Anil
---------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Simple QuickTime Movie Controls</title>
<script language="JavaScript"/* define function that calls
QuickTime's "Play" method */ function PlayIt(anObj) { anObj.Play(); }
/* define function that calls QuickTime's "Stop" method */ function
StopIt(anObj) { anObj.Stop(); } function GeneratePlayer() {
alert("in \"GeneratePlayer()\"");
window.frames['testIframe'].innerHTML = "<object
classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\"
codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" id=\"movie1\"
height=\"160\" width=\"180\"<param name=\"src\" value=\"C:\Program
Files\QuickTime\Sample.mov\"<embed src=\"C:\Program
Files\QuickTime\Sample.mov\" type=\"video/quicktime\"
pluginspage=\"www.apple.com/quicktime/download\" name=\"movie1\"
enablejavascript=\"true\" height=\"160\" width=\"180\"></object>";
}
</script>
</head>
<body>
<pThis page uses JavaScript to control a QuickTime movie... </p>
<div align="center">
<table>
<tbody>
<tr>
<td width="200"<iframe id="testIframe"
name="testIframe"></iframe<a
href="javascript:GeneratePlayer();">GeneratePlayer ()</a><br>
<pMovie1 </p>
</td>
<td width="200"<object
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
id="movie2" height="160" width="180"<param
name="src" value="C:\Program Files\QuickTime\Sample.mov">
<embed src="C:%5CProgram%20Files%5CQuickTime%5CSample.mov "
type="video/quicktime"
pluginspage="www.apple.com/quicktime/download" name="movie2"
enablejavascript="true" height="160" width="180"></object>
<pMovie2 </p>
</td>
</tr>
</tbody>
</table>
</div>
<p>Pass movie name as a parameter to JavaScript functions defined
locally: <br>
<a href="javascript:PlayIt(document.movie1);">PlayIt( movie1)</a><br>
<a href="javascript:StopIt(document.movie1);">StopIt( movie1)</a><br>
<a href="javascript:PlayIt(document.movie2);">PlayIt( movie2)</a><br>
<a href="javascript:StopIt(document.movie2);">StopIt( movie2)</a><br>
</p>
<p>Control movie by name directly: <br>
<a href="javascript:document.movie1.Play();">movie1.P lay()</a><br>
<a href="javascript:document.movie1.Stop();">movie1.S top()</a><br>
<a href="javascript:document.movie2.Play();">movie2.P lay()</a><br>
<a href="javascript:document.movie2.Stop();">movie2.S top()</a><br>
</p>
<p>Replace a movie by name directly: <br>
<a
href="javascript:document.movie1.SetURL('MyOther.m ov');">movie1.SetURL(MyOther.mov)</a><br>
<a
href="javascript:document.movie1.SetURL('My.mov'); ">movie1.SetURL(My.mov)</a><br>
<a
href="javascript:document.movie2.SetURL('MyOther.m ov');">movie2.SetURL(MyOther.mov)</a><br>
<a
href="javascript:document.movie2.SetURL('My.mov'); ">movie2.SetURL(My.mov)</a><br>
</p>
</body>
</html>
Jan 2 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.