Forum Moderators: open

Message Too Old, No Replies

is it possible to load a .mov file in it's own window with java?

         

grandevolution

1:46 am on Jun 26, 2004 (gmt 0)

10+ Year Member



i desperately want to post a video to my website. I have been sucessful, but, i want it to LOOK nice...:)
therefore, i want the .mov file to load in a new window of it's own.
I found a script that does what i want (I think) for IMAGES, but, can it be modified for vids?
see below...

<script language="javascript" type="text/javascript">
<!--
function DisplayImage(picURL,picWidth,picHeight){
newWindow=window.open(picURL,'newWin','toolbar=no,width='+picWidth+',
height='+picHeight)
newWindow.document.write('<html><head><\/head><body background=
"'+picURL+'"><\/body><\/html>')
newWindow.resizeBy(picWidth-newWindow.document.body.clientWidth,
picHeight-newWindow.document.body.clientHeight)
newWindow.focus()
}
//-->
</script>

any replies/help are appreciated

RonPK

4:53 pm on Jun 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there, grandevolution, welcome.

Have you tried to replace

<body background="'+picURL+'"><\/body>

with something like

<body style="margin:0; padding:0"><object ...><param ...><embed ...><\/embed><\/object><\/body>

You will have to fill in the object and embed information with parameters for your video. Plenty of examples on the web.

grandevolution

11:46 pm on Jun 26, 2004 (gmt 0)

10+ Year Member



hey, thanks for the reply. Ithought your idea was correct. however, i have been trying to make this work, and still cannot. i can get a blank window to pop up if i take the "object" part of the code out of the java, but as soon as i put it in, it gives an 'error on page'.
when i take it out seperately, and make it it's own html page, it works fine on my server...
so,
is it my syntax?
ps, i'm fairly novice at java, so what's the deal with the \/ tags? is that where my problem lies?

see the page source code at <snip>
it's the link marked Test

Thanks again..

[edited by: engine at 8:47 am (utc) on June 28, 2004]
[edit reason] No urls, thanks. See TOS [webmasterworld.com] [/edit]

RonPK

8:07 am on Jun 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Inside a block of JavaScript the / has a special meaning: some browsers may interpret it a as a sign to close the <script> tag. To prevent that from happening, you need to escape the / with a \.

JavaScript and Java are two very different things. Java is a full blown programming language, which needs a separate interpreter to run. JavaScript is a nice and simple script language that can be embedded into web pages to add some interactivity to otherwise static html pages.

Anyway: the problem is most likely caused by line breaks inside the document.write-string. You can either remove all the line breaks and put the whole string on 1 line, or issue several document.writes:

newWindow.document.write('<html><head><title>title here</title><\/head>');
newWindow.document.write('<body style="margin:0; padding:0">');
newWindow.document.write('<object ...>');
[...]

That should work...

grandevolution

10:43 pm on Jun 28, 2004 (gmt 0)

10+ Year Member



i got it to work, by putting it all onthe same line!
thanks for your help, and the insight into javascript!

any suggestions for good places for basic lessons/examples where i can learn javascript better?
thanks again

RonPK

8:27 am on Jun 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Webmonkey tutorials [hotwired.lycos.com] are often pretty good. And off course there is this forum's library [webmasterworld.com]. You may also want to have a look at the JavaScript reference [devedge.netscape.com]. Some knowledge of the Document Object Model [mozilla.org] is very useful. And there is MS's documentation of sometimes propietary DHTML properties and methods [msdn.microsoft.com].

That should get you going!