Problem with <DIV>

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with <DIV>

the-wizard
Hi to all,
I have a problem with this library shadowbox with the load a div,

I load in the index.php
<body onload="shadowbox.init();">
if i try to use some link into this page works perfectly for example:
"a href='test.swf' rel='shadowbox;width=200;height=100'>Test shadowbox</a"
instead if i use a button for load one <div> where into this i put a link "a href='test.swf' rel='shadowbox;width=200;height=100'>Test shadowbox</a" doesn't work.
i don't know
help me please <smiley image='smiley_sad.gif' text=':-((' />
Reply | Threaded
Open this post in threaded view
|

Problem with <DIV>

the-wizard
This is the part of code doesn't work.
Work only into the page but doesn't work when i load the div with the div :(

<html>
<head>
<link rel="stylesheet" type="text/css" href="shadowbox/src/css/shadowbox.css">
<script type="text/javascript" src="shadowbox/src/js/lib/yui-utilities.js"></script><script type="text/javascript" src="shadowbox/src/js/adapter/shadowbox-yui.js"></script><script type="text/javascript" src="shadowbox/src/js/shadowbox.js"></script><script> function media (){ document.getElementById("video").innerHTML = ("a href='test.swf' rel='shadowbox;width=100;height=200'>test shadowbox</a"); } </script></head>
<body onload="javascript:Shadowbox.init();">
<div id="video">
</div>
a href='test.swf' rel='shadowbox;width=100;height=200'>test shadowboxload link into div
</html>

thanks
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <DIV>

Wizzud
Set your 'DOM Ready' or onload code to do both things, ie to modify the DOM (adding the extra link to #video) and then calling Shadowbox.init().

[btw you'd probably be better off using YUI's onDOMReady(), or window.onload]
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <DIV>

the-wizard
thanks for the answer but is possible an example please ?
I am desperate :|
Reply | Threaded
Open this post in threaded view
|

Re: Problem with <DIV>

Wizzud
I don't use YUI so this is (partially) lifted from the Shadowbox documentation (implication : rtfm!)...

<script type="text/javascript"> YAHOO.util.Event.onDOMReady(function(){ var nlink = '<' + "a href='test.swf' rel='shadowbox;width=100;height=200'>test shadowbox</a" + '>' , video = document.getElementById('video'); if(video) video.innerHTML = nlink; Shadowbox.init(); }); </script>
Or, using window.onload...

<script type="text/javascript"> var wdwOnload = function(){ var nlink = '<' + "a href='test.swf' rel='shadowbox;width=100;height=200'>test shadowbox</a" + '>' , video = document.getElementById('video'); if(video) video.innerHTML = nlink; Shadowbox.init(); }; window.onload = wdwOnload; </script>
There's nothing difficult here - it's standard javascript, and reading the Shadowbox documentation.
Combine literacy with curiosity and a whole world of information opens up to you