HighDots Forums  

Can I use javascript in html object definition?

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Can I use javascript in html object definition? in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pascal Herczog
 
Posts: n/a

Default Can I use javascript in html object definition? - 11-11-2005 , 03:07 PM






I've got an embedded object definition, like

<OBJECT id='mediaPlayer' width="480" height="360"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...'
type='application/x-oleobject'>
<param name='fileName' value="Mymovie.mpg">
....

I'm wondering whether I can 'call' some javascript to enable me to generate
the required parameter value for the filename parameter. So, instead of
being hardcoded to say "Mymovie.mpg", I'd like to call a javascript function
or directly use a variable that returns the string from the
URL?name=movie.mpg parameter.

I've already got the javascript working to set a variable named qsParm[0] to
"movie.mpg"

That way I can call the same file from different URL's and simply specify
the file name to be played in the URL, rather than have loads of separate
html files for each.

Can someone tell me whether this is possible as described? I can't do PHP
etc.

Thanks!
Pascal



Reply With Quote
  #2  
Old   
vizo
 
Posts: n/a

Default Re: Can I use javascript in html object definition? - 11-13-2005 , 07:08 AM






if you mean to generate the html codes by javascript like your sample,
i think there are several possible solutions.

1.use static javascript and a pre-defined variable
that is possible to define a variable outside a script file.
for example,use html like below:

<script language="javascript">
var mpgFile = "movie.mpg" ;
</script>
<script language="javascript" src="generateHtml.js"/>

while in file 'generateHtml.js' you use a non-defined variable 'mpgFile',
to build the html code,
and use document.write() to output



2.use dymatic javascript and a server variable
use code like this:
<script language="javascript" src="generateHtml.php?mpgFile=movie.mpg"/>
file 'generateHtml.php' should use sever variable $mpgFile ,
and output the entire html like your codes
using document.write() to output that~



hope help



Regards
vizo

Pascal Herczog wrote:
Quote:
I've got an embedded object definition, like

OBJECT id='mediaPlayer' width="480" height="360"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...'
type='application/x-oleobject'
param name='fileName' value="Mymovie.mpg"
...

I'm wondering whether I can 'call' some javascript to enable me to generate
the required parameter value for the filename parameter. So, instead of
being hardcoded to say "Mymovie.mpg", I'd like to call a javascript function
or directly use a variable that returns the string from the
URL?name=movie.mpg parameter.

I've already got the javascript working to set a variable named qsParm[0] to
"movie.mpg"

That way I can call the same file from different URL's and simply specify
the file name to be played in the URL, rather than have loads of separate
html files for each.

Can someone tell me whether this is possible as described? I can't do PHP
etc.

Thanks!
Pascal



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.