Javascript Dynamic Popup, Include File ??

Discussion in 'JavaScript' started by advancedfuture, Mar 11, 2007.

  1. #1
    Here is my scenario:

    On my main page I have several links.

    I want those links to do a dynamic popup. In the dynamic popup will be a textarea box with a copy of some code snippets. The code snippet shown in the dynamic popup will be based on the link pressed.

    Now I know how to create a dynamic popup. And i know how to call a file and insert the contents into a textarea box. But I dont know how to combine the 2 to make it dynamic... All in all I dont want to have to create 1000 seperate popups. Any input would be appreciated
     
    advancedfuture, Mar 11, 2007 IP
  2. advancedfuture

    advancedfuture Banned

    Messages:
    481
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hah read up on some PHP and Javascript... Solved my problem....

    My main page code is:

    <script language="javascript">
    function openPopup(url) {
     var remotefile;
     window.open(url, "popup_id", "scrollbars,resizable,width=300,height=400");
     return false;
    }
    </script>
    
    ******
    <a href="text2.php?remotefile=text.txt" onclick="return openPopup(this.href);">Open Popup</a>
    Code (markup):
    And my popup page code is:

    <?php
    $passed_value = $_GET['remotefile'];
    ?>
    
    .................
    
    <textarea onclick="focus(); select()" cols="65" rows="10" name="textfield" <?php include($passed_value);?></textarea>
    Code (markup):
     
    advancedfuture, Mar 11, 2007 IP