Results 1 to 3 of 3

Thread: lightbox instead of window.open

  1. #1
    Join Date
    Oct 2009
    Posts
    31
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default lightbox instead of window.open

    Hi, Im using the following javascript function on the page where i click to open a pop up which contains smileys:

    index.php:
    Code:
    <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:

    Code:
    <a href="javascript:showSmileys();void(0)">Smileys</a>
    And then on the poped up page (smileys page), I have the following javascript:

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

    and im using it like this:

    Code:
    <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
    Last edited by newbtophp; 10-24-2009 at 08:14 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Install the lightbox gone wild scripts on index.php as instructed and change this:

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

    Code:
    <a href="smileys.htm" class="lbOn">Smileys</a>
    and change this:

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

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

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    newbtophp (10-29-2009)

  4. #3
    Join Date
    Oct 2009
    Posts
    31
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks solved

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •