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 2072
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: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |