Hi,
I realize my first problem is that I'm using browser detection and not
feature detection. Maybe someone can help me understand feature
detection.
This script works in every browser that I need it too, except Safari
1.0.2
Here is the script. Please tell me if there is any more information I
can give you.
<script language=javascript type="text/javascript">
function hideDiv() {
if (document.getElementById) {
document.getElementById('hideshow').style.visibili ty = 'hidden';
}
else {
if (document.layers) {
document.hideshow.visibility = 'hidden';
}
else { document.all.hideshow.style.visibility = 'hidden';
}
}
}
function showDiv() {
if (document.getElementById) {
document.getElementById('hideshow').style.visibili ty = 'visible';
}
else {
if (document.layers) { document.hideshow.visibility = 'visible';
}
else { document.all.hideshow.style.visibility = 'visible';
}
}
}</script>
<script LANGUAGE=JavaScript>var movieName = "movie";
function thisMovie(movieName) {
if (navigator.appName.indexOf ("Microsoft") !=-1) {
return window[movieName]
} else {
return document[movieName]
}
}
function rewind() {
thisMovie(movieName).Rewind();
thisMovie(movieName).StopPlay();
hideDiv();
}
function play(){
showDiv();
thisMovie(movieName).Play();
}</script>
Thanks
Kim 5 2058
Kim Forbes said: Here is the script. Please tell me if there is any more information I can give you.
Could you format it with some indentation to make it readable?
<script language=javascript type="text/javascript"> function hideDiv() { if (document.getElementById) { document.getElementById('hideshow').style.visibil ity = 'hidden'; } else { if (document.layers) { document.hideshow.visibility = 'hidden'; } else { document.all.hideshow.style.visibility = 'hidden'; } } } function showDiv() { if (document.getElementById) { document.getElementById('hideshow').style.visibil ity = 'visible'; } else { if (document.layers) { document.hideshow.visibility = 'visible'; } else { document.all.hideshow.style.visibility = 'visible'; } } }</script>
In article <de**************************@posting.google.com >, ki********@tch.harvard.edu enlightened us with... Hi,
I realize my first problem is that I'm using browser detection and not feature detection. Maybe someone can help me understand feature detection.
You ARE using feature detection for some of it.
This script works in every browser that I need it too, except Safari 1.0.2
What happens (or doesn't happen) in Safari?
Here is the script. Please tell me if there is any more information I can give you. <script language=javascript type="text/javascript"> function hideDiv() { if (document.getElementById) { document.getElementById('hideshow').style.visibili ty = 'hidden';
Don't assume that a browser that supports getElementById also supports style.
Check for that, too.
} else { if (document.layers) { document.hideshow.visibility = 'hidden'; } else { document.all.hideshow.style.visibility = 'hidden'; }
Don't assume. Your last 'else' assumes that if a browser doesn't have the
first two, it has the third. Bad assumption.
Make it an else if document.all, then have a last else that basically shows a
friendly error or something that the browser isn't supported. <script LANGUAGE=JavaScript>var movieName = "movie";
Type attribute here like above would be great.
function thisMovie(movieName) { if (navigator.appName.indexOf ("Microsoft") !=-1) { return window[movieName] } else { return document[movieName] }
You could just test for window[movieName] (that doesn't look right to me, but
I'm not familiar with media) and document[movieName] instead of using
navigator.
That's all I have, sorry.
--
--
~kaeli~
Punctuation, capitalization, and grammar are your friends,
and will help people think that you aren't such an ignorant
moron, after all. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
Kim Forbes wrote: Hi,
I realize my first problem is that I'm using browser detection and not feature detection. Maybe someone can help me understand feature detection. This script works in every browser that I need it too, except Safari 1.0.2
I don't understand why you want to control the playing of the video
yourself. Safari will load the video into a Quicktime plugin which
already has controls for play, pause, stop, rewind, fastforward,
volume, etc.
Placing a second set of controls will likely only confuse the user -
what's the point? The general form for putting a Quicktime movie (.mov)
file into a browser window is (please excuse wrapping):
<OBJECT
CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
WIDTH="240" HEIGHT="152"
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0">
<PARAM NAME="controller" VALUE="TRUE">
<PARAM NAME="type" VALUE="video/quicktime">
<PARAM NAME="autoplay" VALUE="false">
<PARAM NAME="target" VALUE="myself">
<PARAM NAME="src" VALUE="somePath/myMovie.mov">
<PARAM NAME="pluginspage"
VALUE="http://www.apple.com/quicktime/download/indext.html">
<EMBED WIDTH="240" HEIGHT="152"
CONTROLLER="TRUE" TARGET="myself"
SRC="somePath/myMovie.mov"
type="video/quicktime"
BGCOLOR="#000000" BORDER="0"
PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html"></EMBED>
</OBJECT>
Fred.
This really got me thinking, so here is a page that lets you
load/unload a Quicktime movie. I thinks it's cool because the video is
not hosted on my server but on Apple's!
I tried just showing/hiding the div, and whilst that works the first
time, when you hide it then show it again, the video doesn't play. I
have commented out the bits that display the video in a new window, you
can use that instead if you want.
This is not robust, www ready code but a proof of concept effort - I'm
happy for suggestions on how to detect if the user has the Quicktime
plugin installed - or should I just let the browser handle it?
Hope it works for everyone out there, please be careful of wrapping...
Fred.
<html><head><title> Safari Video</title>
<script type="text/javascript">
function loadVid(vidDiv) {
// var vidWin = window.open('',
// 'VideoWindow','resizable=1,width=400,height=400')
var a = [
// '<html><head><title> Video Window</title>',
// '</head><body>',
'<OBJECT id="aMovie" ',
'CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
' WIDTH="240" HEIGHT="152" ',
'
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"> ',
' <PARAM NAME="controller" VALUE="TRUE"> ',
' <PARAM NAME="type" VALUE="video/quicktime"> ',
' <PARAM NAME="autoplay" VALUE="true"> ',
' <PARAM NAME="target" VALUE="myself"> ',
' <PARAM NAME="src" ',
' VALUE="file:///Users/rogreen/Desktop/farscape_240.mov"> ',
' <PARAM NAME="pluginspage" ',
' VALUE="http://www.apple.com/quicktime/download/indext.html">',
' <EMBED WIDTH="240" HEIGHT="152" ',
' CONTROLLER="TRUE" TARGET="myself" ',
'
SRC="http://movies.apple.com/movies/independent/farscape/farscape_240.mov"
',
' type="video/quicktime" ',
' BGCOLOR="#003366" BORDER="0" ',
' PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html">',
'</EMBED> ',
'</OBJECT> ',
// '</body></html>',
];
// alert(a.join(" "));
document.getElementById(vidDiv).innerHTML = a.join(" ");
document.getElementById(vidDiv).style.display = '';
// vidWin.document.write(a.join(""))
// vidWin.document.close()
}
function unLoadVid(vidDiv) {
document.getElementById(vidDiv).style.display = 'none';
document.getElementById(vidDiv).innerHTML = "";
}
</script>
</head><body>
<div style="border: thin solid red; width: 240; height: 30;">
<form action="">
<input type="button" value="Video load"
onclick="loadVid('theMovie');">
<input type="button" value="Video unload"
onclick="unLoadVid('theMovie');">
</form>
</div>
<div id="theMovie"
style="border: thin solid red; width: 240; height: 152; display: none;">
</div>
</body></html>
Thanks everyone for answering my post. I have had a incredibly busy
week, and I'm just checking my messages now. I am going to look them
over in detail ASAP, but let me just clarify what I was trying to do:
I wanted a Flash movie to play "inline" from a HTML help topic I was
writing. For example, if I was showing people how to use Widget x, I
wanted to give the user an option of viewing the procedure from the
topic, but not force the movie to play upon loading the topic. I hope
that makes sense?
Kim
Fred Oz <oz****@iinet.net.au> wrote in message news:<41***********************@per-qv1-newsreader-01.iinet.net.au>... This really got me thinking, so here is a page that lets you load/unload a Quicktime movie. I thinks it's cool because the video is not hosted on my server but on Apple's!
I tried just showing/hiding the div, and whilst that works the first time, when you hide it then show it again, the video doesn't play. I have commented out the bits that display the video in a new window, you can use that instead if you want.
This is not robust, www ready code but a proof of concept effort - I'm happy for suggestions on how to detect if the user has the Quicktime plugin installed - or should I just let the browser handle it?
Hope it works for everyone out there, please be careful of wrapping...
Fred.
<html><head><title> Safari Video</title> <script type="text/javascript">
function loadVid(vidDiv) {
// var vidWin = window.open('', // 'VideoWindow','resizable=1,width=400,height=400')
var a = [ // '<html><head><title> Video Window</title>', // '</head><body>', '<OBJECT id="aMovie" ', 'CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ', ' WIDTH="240" HEIGHT="152" ', ' CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"> ', ' <PARAM NAME="controller" VALUE="TRUE"> ', ' <PARAM NAME="type" VALUE="video/quicktime"> ', ' <PARAM NAME="autoplay" VALUE="true"> ', ' <PARAM NAME="target" VALUE="myself"> ', ' <PARAM NAME="src" ', ' VALUE="file:///Users/rogreen/Desktop/farscape_240.mov"> ', ' <PARAM NAME="pluginspage" ', ' VALUE="http://www.apple.com/quicktime/download/indext.html">', ' <EMBED WIDTH="240" HEIGHT="152" ', ' CONTROLLER="TRUE" TARGET="myself" ', ' SRC="http://movies.apple.com/movies/independent/farscape/farscape_240.mov" ', ' type="video/quicktime" ', ' BGCOLOR="#003366" BORDER="0" ', ' PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html">', '</EMBED> ', '</OBJECT> ', // '</body></html>', ]; // alert(a.join(" "));
document.getElementById(vidDiv).innerHTML = a.join(" "); document.getElementById(vidDiv).style.display = '';
// vidWin.document.write(a.join("")) // vidWin.document.close()
}
function unLoadVid(vidDiv) { document.getElementById(vidDiv).style.display = 'none'; document.getElementById(vidDiv).innerHTML = ""; } </script>
</head><body>
<div style="border: thin solid red; width: 240; height: 30;"> <form action=""> <input type="button" value="Video load" onclick="loadVid('theMovie');"> <input type="button" value="Video unload" onclick="unLoadVid('theMovie');"> </form> </div> <div id="theMovie" style="border: thin solid red; width: 240; height: 152; display: none;"> </div>
</body></html> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MPennig |
last post by:
Here's my situation. I have a function defined in my document's <head>
section which adds a <script> tag to a specified <div> tag. The added
<script> has a src="" attribute pointing to a PHP file,...
|
by: Michael Bierman |
last post by:
Please forgive the simplicy of this question. I have the following code
which attempts to determine the color of some text and set other text
to match that color. It works fine in Firefox, but does...
|
by: elektrophyte |
last post by:
I've got a short script that works fine in I.E. and Firefox, but not in
Safari. It is supposed to print a constantly-updating counter on the
webpage. Any ideas how to get it to work in Safari? The...
|
by: Andrew Poulos |
last post by:
Is there a safe way to get the version of IE? I've done a google and
found this code:
var version=0
if (navigator.appVersion.indexOf("MSIE") != -1) {
temp = navigator.appVersion.split("MSIE");...
|
by: Qun Cao |
last post by:
Hi Everyone,
I am a beginner on cross language development. My problem at hand is to
build a python interface for a C++ application built on top of a 3D
game engine. The purpose of this python...
|
by: Ralph |
last post by:
Hi
Is it possible to trigger the certain event from JS function?
I have an image with on click event handler assigned. Now if like to
trigger this event for this image from some other...
|
by: gentsquash |
last post by:
Can javascript (easily) produce a click from the PC-speaker?
This is the speaker that is (well, used to be) directly on
the CPU-card and was -I believe- intended to give feedback
to the typist,...
|
by: Chris Riesbeck |
last post by:
I have an image with a class and the class defines a clip rectangle.
In Firefox 2 and 3, and Opera 9, I can access the rectangle with
document.defaultView.getComputedStyle().
But that doesn't...
|
by: ddg_linux |
last post by:
I have been reading about and doing a lot of php code examples from
books but now I find myself wanting to do something practical with
some of the skills that I have learned.
I am a beginner php...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |