By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,045 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,045 IT Pros & Developers. It's quick & easy.

pop up window ajax

P: 8
not sure if some one got a answer to this little issue. Im built a page that calls information from a page called database-update.asp and puts it in to the div tag Reload this. What i am trying to do is make a pop up so if some one clicks the link shown it open a pop up window. When trying to do this nothing happens. Any ideas how i can get a pop up window. I be Honest i do not understand ajax as im just using it as a refresh method to get new information every 5 seconds from a event log system im working on. Before some one points out im bypassing the users ablity to have a click noise, we had a refresh with a click and it annoyed all the programmers with it and was counter productive for other areas.

here is my code

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. <!--
  3. .style1 {font-family: Arial, Helvetica, sans-serif}
  4. body {
  5.     margin: 0px 0px 0px 0px;
  6.     background-color: #FFFFFF;
  7.     }
  8. .style3 {
  9.     color: #FF0000;
  10.     font-weight: bold;
  11.     font-family: Arial, Helvetica, sans-serif;
  12. }
  13. -->
  14. </style>
  15. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
  16. <body>
  17. <script type="text/javascript">
  18. function Ajax(){
  19. var xmlHttp;
  20.     try{    
  21.         xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
  22.     }
  23.     catch (e){
  24.         try{
  25.             xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
  26.         }
  27.         catch (e){
  28.             try{
  29.                 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  30.             }
  31.             catch (e){
  32.                 alert("No AJAX!?");
  33.                 return false;
  34.             }
  35.         }
  36.     }
  37.  
  38. xmlHttp.onreadystatechange=function(){
  39.     if(xmlHttp.readyState==4){
  40.         document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
  41.         setTimeout('Ajax()',10);
  42.     }
  43. }
  44. xmlHttp.open("GET","database-update.asp",true);
  45. xmlHttp.send(null);
  46. }
  47.  
  48. window.onload=function(){
  49.     setTimeout('Ajax()',100);
  50. }
  51. </script>
  52.  
  53. <div class="style1" id="ReloadThis"></div>
  54.  
Jul 25 '09 #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,390
the only thing i could see is, that you don't call the service every 5s but after 100ms the first time and then 10ms later, when the response is ready. you may use the window.open() method to open a plain popup but currently you just set the innerHTML of you mentioned diff. i think i don't get the point quite well - where is a link and when do you want the popup?

kind regards
Jul 27 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.