PDA

View Full Version : Resolved lightbox instead of window.open



newbtophp
10-19-2009, 10:36 AM
Hi, Im using the following javascript function on the page where i click to open a pop up which contains smileys:

index.php:

<script>
function showSmileys(){
var w = window.open('smileys.htm','Smiley Chooser','width=610,height=550,scrollbars=1');
w.targetField = targetField;
w.focus();
return false;
}
function insertSmiley(a){
document.getElementById('msg_txt').value += a;
}
</script>

I click the following code which opens the smileys popup:


<a href="javascript:showSmileys();void(0)">Smileys</a>

And then on the poped up page (smileys page), I have the following javascript:

smileys.htm:

<script>
function putSmiley(a){
opener.insertSmiley(a);
window.close();
}
</script>


and im using it like this:


<a href="javascript:putSmiley(':))');void(0)" style="text-decoration:none;color:white;"><img src="images/smileys/21.gif" title="laughing"></a>

When i click on the smiley it places it within index.php, but what i want to do is instead of opening the smileys.htm page in a popup, open it in a lightbox.

I found the following code: ( http://particletree.com/examples/lightbox/ ) which is the effect that im after, anyone can help:confused:

jscheuer1
10-19-2009, 11:32 AM
Install the lightbox gone wild scripts on index.php as instructed and change this:


<a href="javascript:showSmileys();void(0)">Smileys</a>

to:


<a href="smileys.htm" class="lbOn">Smileys</a>

and change this:


<a href="javascript:putSmiley(':))');void(0)" style="text-decoration:none;color:white;"><img src="images/smileys/21.gif" title="laughing"></a>

to:


<a href="#" class="lbAction" rel="deactivate"
style="text-decoration:none;color:white;"><img src="images/smileys/21.gif"
onclick="insertSmiley(':))');" title="laughing"></a>

newbtophp
10-24-2009, 08:14 PM
Thanks solved :rolleyes: