how to dynamically set content of iframe?

A

Anil

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/documentation/QuickTime/Conceptual/QTScripting_JavaScript/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>
<p> This 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>
<p> Movie1 </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>
<p> Movie2 </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.Play()</a><br>
<a href="javascript:document.movie1.Stop();">movie1.Stop()</a><br>
<a href="javascript:document.movie2.Play();">movie2.Play()</a><br>
<a href="javascript:document.movie2.Stop();">movie2.Stop()</a><br>
</p>
<p>Replace a movie by name directly: <br>
<a
href="javascript:document.movie1.SetURL('MyOther.mov');">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.mov');">movie2.SetURL(MyOther.mov)</a><br>
<a
href="javascript:document.movie2.SetURL('My.mov');">movie2.SetURL(My.mov)</a><br>
</p>
</body>
</html>
 
A

Anil

no replies?
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/documentation/QuickTime/Conceptual/QTScripting_JavaScript/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>
<p> This 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>
<p> Movie1 </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>
<p> Movie2 </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.Play()</a><br>
<a href="javascript:document.movie1.Stop();">movie1.Stop()</a><br>
<a href="javascript:document.movie2.Play();">movie2.Play()</a><br>
<a href="javascript:document.movie2.Stop();">movie2.Stop()</a><br>
</p>
<p>Replace a movie by name directly: <br>
<a
href="javascript:document.movie1.SetURL('MyOther.mov');">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.mov');">movie2.SetURL(MyOther.mov)</a><br>
<a
href="javascript:document.movie2.SetURL('My.mov');">movie2.SetURL(My.mov)</a><br>
</p>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top