abazoskib Posted August 17, 2009 Share Posted August 17, 2009 this code works fine in IE7. var win=null; function NewWindow(mypage,myname,w,h,scroll,pos){ if(pos=="random"){LeftPosition=(screen.availWidth)?Math.floor(Math.random()*(screen.availWidth-w)):50;TopPosition=(screen.availHeight)?Math.floor(Math.random()*((screen.availHeight-h)-75)):50;} if(pos=="center"){LeftPosition=(screen.availWidth)?(screen.availWidth-w)/2:50;TopPosition=(screen.availHeight)?(screen.availHeight-h)/2:50;} if(pos=="default"){LeftPosition=50;TopPosition=50} else if((pos!="center" && pos!="random" && pos!="default") || pos==null){LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes'; win=window.open(mypage,myname,settings); if(win.focus){win.focus();} } function CloseNewWin(){if(win!=null && win.open)win.close()} window.onfocus=CloseNewWin; $query = "SELECT ...."; $result = mysql_query($query); echo "<script type=\"text/javascript\">"; echo "window.opener.document.getElementById('XX').length = 0;"; while($row=mysql_fetch_assoc($result)) { $id = $row['id']; $name = $row['name']; $code = $row['code']; $text = $code." - ".$name; $splice = $id."-".$code; echo "var newOption = window.opener.document.createElement('<option value=\"$splice\">');"; echo "window.opener.document.getElementById('XX').options.add(newOption);"; echo "newOption.innerText = \"$text\";"; if(strcmp($code,$value) == 0) { echo "var len = window.opener.document.getElementById('XX').length;"; echo"window.opener.document.getElementById('XX').selectedIndex = len-1;"; } } echo "</script>"; basically after adding a new entry into the database, i repopulate the drop down after a post using php and javascript. however this does not work in firefox. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.