Click here to Skip to main content
15,891,935 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can open a div using javascript n set the div position (dynamic)
next to each link
here i want to pass some msg to div
please help
Posted

<script src="http://code.jquery.com/jquery-latest.js"></script>
   <script language ="javascript" >

   function GetPage(pagename) {
           $.ajax({ url: 'Default2.aspx', type: 'POST', async: false, data: { param: 'abcd' },
               success: function(obj) {
                   var div = $('#maincontent', obj);


               }
           });
   }
 
Share this answer
 
v3
Hi,

check this code once

HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script language ="javascript" >
        $(document).ready(function (evt) {
            $("#popupdiv").hide();
        });
        function showdiv(tid,asd) {
            $("#popupcontent").html("Your message is :" + asd)

            $("#popupdiv").css("position", "fixed");
            $("#popupdiv").css("left", "150px");
            $("#popupdiv").css("top", "150px");
            $("#popupdiv").show();
        }
        function closepopup() {
            $("#popupdiv").hide();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <a href="#" onclick="showdiv(this,'frst')">this is first</a><br />
    <a href="#" onclick="showdiv(this,'second')">this is second</a><br /><br /><br /><br /><br /><br />
    <a href="#" onclick="showdiv(this,'third')">this is thrid</a><br /><br /><br /><br /><br /><br /><br /><br />
    <a href="#" onclick="showdiv(this,'fourth')">this is fourth</a><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
    </div>
    <div id="popupdiv" style=" width :200px; height :200px; background-color :Red ;">
    <div id="popupcontent"></div>
    this is popup div<br />
     <a href="#" onclick="closepopup()">close</a>
    </div>
    </form>
</body>
</html>


All the Best
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900