We help IT Professionals succeed at work.
Get Started

how can i use jquery  popupmessage box in for loop to display a particular for value on click in php?

sonalaroi
sonalaroi asked
on
1,734 Views
Last Modified: 2012-05-09
my code is here.i use for loop to display 5 time click option.when i click on specific click option i want to display the current option number but popup messege  display only first number on each option.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
      <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
            <script type="text/javascript" src="jquery.jmpopups-0.5.1.js"></script>
            <script type="text/javascript">
                  //<![CDATA[
                        $.setupJMPopups({
                              screenLockerBackground: "#003366",
                              screenLockerOpacity: "0.7"
                        });

                        function openStaticPopup() {
                              $.openPopupLayer({
                                    name: "myStaticPopup",
                                    width: 550,
                                    target: "myHiddenDiv"

                              });
                              

                        }

                                    </script>
            <style type="text/css" media="screen">
                  body {margin:0; font-family:"Trebuchet MS"; line-height:120%; color:#333;}
                  h1 {margin-bottom:50px; font-size:40px; font-weight:normal;}
                  p {margin:0; padding:0 0 30px; font-size:12px;}
                  pre {font-size:12px; font-family:"Consolas","Monaco","Bitstream Vera Sans Mono","Courier New","Courier"; line-height:120%; background:#F4F4F4; padding:10px;}
                  #general {margin:30px;}
                  
                  #myHiddenDiv {display:none;}
                  
                  .popup {background:#FFF; border:1px solid #333; padding:1px;}
                  .popup-header {height:24px; padding:7px; background:url("bgr_popup_header.jpg") repeat-x;}
                  .popup-header h2 {margin:0; padding:0; font-size:18px; float:left;}
                  .popup-header .close-link {float:right; font-size:11px;}
                  .popup-body {padding:10px;}
                  
                  form {margin:0; padding:0;}
                  form * {font-size:12px;}
                  input {margin-bottom:12px;}
                  label {display:block;}
            </style>
            <title>jmpopups - example page</title>
      </head>
      <body>
<?php

for($i=1;$i<5;$i++)
{?>

            <div id="general">
                                    
                  <p><a href="javascript:;" onclick="openStaticPopup()" title="Static example">Open a popup</a></p>
                  
                  </div>


            <div id="myHiddenDiv">

                  <div class="popup">
                        <div class="popup-header">
                              <h2>Now  example</h2>
                                                      </div>

                        <div class="popup-body">
                              <code>
                                    <pre>

<?php echo $x; ?>
                                    </pre>
                              </code>
      
                              
                        </div>
                  </div>
            
      </body>
</html>
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE