Click here to Skip to main content
15,917,875 members
Please Sign up or sign in to vote.
1.67/5 (6 votes)
See more:
Heres my very experimental site
http://quidpro.comuf.com/punani/index.html[^]

I am a baby at javascript i tried this:

<script type="text/javascript">
    $(document)ready.function() {
        $("#modal_link").videobox().trigger('click');
    });
</script>


No joy! Please click link on page to see box open i want to learn how to do this with code.

OK my bad im v.new to posting here i just realised the host shows different code anyway. below is my code oh btw a videobox is a fancybox that opens a video player. http://videobox-lb.sourceforge.net/[^]

XML
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>index</title>

<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/videobox.js"></script>
<link rel="stylesheet" href="css/videobox.css" type="text/css" media="screen">
</head>
<body scroll="no" style="background-image: url(BG.jpg);">

<a href="http://www.youtube.com/watch?v=uhi5x7V3WXE" rel="vidbox" title="caption">our video</a>
<br>
</body></html>
Posted
Updated 5-Jan-11 22:35pm
v5
Comments
Sandeep Mewara 6-Jan-11 1:01am    
I doubt someone will click on just any link!
BTW, What is a videobox here?
Manfred Rudolf Bihy 7-Jan-11 11:59am    
Have a look at my answer. There is a complete working example and some explanations in the source that explain what went wrong. Cheers!
Manfred Rudolf Bihy 7-Jan-11 17:25pm    
If it works for you, I'd appreciate it if you marked my answer as accepted. Thank you!
infamousbreed 7-Jan-11 17:30pm    
done it

1 solution

I've put together a sample that also explains why your script failed. The videobox zip file was extracted into the folder that contains the html file. If you have another setup you'll have to adjust the script and css paths:
JavaScript
<html>
<head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title>My page loads a video!</title>
    <script type="text/javascript" src="./video/js/mootools.js"></script>
    <script type="text/javascript" src="./video/js/swfobject.js"></script>
    <script type="text/javascript" src="./video/js/videobox.js"></script>
    <link rel="stylesheet" href="./video/css/videobox.css" type="text/css" media="screen">
</head>
<body   scroll="no"
        style="background-image: url(BG.jpg);"
        onload="doOpenVideoDelayed('http://www.youtube.com/watch?v=uhi5x7V3WXE', 'Your cool video!', 'vidbox 800 600 play', 1000);">
    <div style="height: 100%; width: 100%;">
    </div>
</body>
<script type="text/javascript">
    // Since the videobox.js script initializes itself at document onload
    // like this: window.addEvent('domready', Videobox.init.bind(Videobox));
    // you'll have to wait a little while until this has finished. Body onload
    // would be called when videobox.js has not yet been initialized. This will
    // cause errors.
    function doOpenVideoDelayed(url, caption, options, delay)
    {
        // Here we set our function to execute after "delay" milliseconds have passed
        // If you look into videobox.js you'll see that Videobox.click(link) in effect
        // calls Videobox.open(url, caption, options), so I decided to stick with the
        // open() approach insteaf of using click(link). This way es don't even need a
        // link on our page.
        window.setTimeout(  function() {
                                Videobox.open(url, caption, options);
                            },
                            delay
                         );
    }
</script>
</html>

Hope this still helps!
Best regards,
Manfred
 
Share this answer
 
Comments
infamousbreed 7-Jan-11 17:19pm    
Thanx Excellent!! it works just fine.
thatraja 7-Jan-11 21:20pm    
Good effort here Manfred....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900