Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with Javascript Please Help

    Hello,

    I am trying to create 2 onclick popup links on the same page, although when i click on the links, they both open up in the same position and im trying to position the popup box to open over the 2 text links, which are in different postition of my page.


    I have created 2 different codes in my stylesheet so i could make the position of the popup open in 2 different positions although it always opens in 1 position only.


    Here is my code:

    CSS

    Code:
    .popup1{
        position:absolute;
        top:140px;   
        left:450px;
        margin:500px auto;
        width:570px;
        height:200px;
        font-family:verdana;
        font-size:13px;
        padding:10px;
        background-color:rgb(240,240,240);
        border:2px solid grey;
        z-index:100000000000000000;
        display:none;
        overflow:scroll;
        }
        
    .cancel{
        display:relative;
        cursor:pointer;
        margin:0;
        float:right;
        height:10px;
        width:34px;
        padding:0 0 5px 0;
        background-color:red;
        text-align:center;
        font-weight:bold;
        font-size:11px;
        color:white;
        border-radius:3px;
        z-index:100000000000000000;
        }
    
    .cancel:hover{
        background:rgb(255,50,50);
        }


    Javascript

    Code:
    <script>
    function openPopup() {
        document.getElementById('pop1').style.display = 'block';
    }
    
    function closePopup() {
        document.getElementById('pop1').style.display = 'none';
    }
    function openPopup() {
        document.getElementById('pop2').style.display = 'block';
    }
    
    function closePopup() {
        document.getElementById('pop2').style.display = 'none';
    }
    </script>

  • #2
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So i am basically trying to add this code from jsfiddle to work with 2 links on the same website page.


    http://jsfiddle.net/WGPhG/7/


    I would appreciate any help, i have spent over 6-7 hrs and cannot figure it out.


  •  

    Posting Permissions

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