Php 如何使javascript在所有浏览器上运行?

Php 如何使javascript在所有浏览器上运行?,php,javascript,Php,Javascript,我通过更具描述性的方式更新我的问题 <script type="text/javascript"> function myPopup2() { var iMyWidth; var iMyHeight; //half the screen width minus half the new window width (plus 5 pixel borders). iMyWidth = (window.screen.

我通过更具描述性的方式更新我的问题

<script type="text/javascript">
    function myPopup2() {
        var iMyWidth;
        var iMyHeight;

        //half the screen width minus half the new window width (plus 5 pixel borders).
        iMyWidth = (window.screen.width/2) - (75 + 10);

        //half the screen height minus half the new window height (plus title and status bars).
        iMyHeight = (window.screen.height/2) - (100 + 50);

        window.open( "xyz.php" ,Store Record" ,"status=yes,height=300,width=350,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
    }
</script>

函数myPopup2(){
var iMyWidth;
var iMyHeight;
//屏幕宽度的一半减去新窗口宽度的一半(加上5个像素边框)。
iMyWidth=(window.screen.width/2)-(75+10);
//屏幕高度的一半减去新窗口高度的一半(加上标题栏和状态栏)。
iMyHeight=(window.screen.height/2)-(100+50);
window.open(“xyz.php”,Store Record”,“status=yes,height=300,width=350,resizable=yes,left=“+iMyWidth+”,top=“+imywhite+”,screenX=“+imywhite+”,screenY=“+imywhite+”,toolbar=no,menubar=no,滚动条=no,location=no,directories=no”);
}
是不适用于IE8的javascript。当我在windows7上尝试使用FF 3.6.16时,它的行为异常。有时它会在弹出窗口中显示代码


谢谢,

您需要使用跨浏览器兼容的javascript。您可以通过以下方式实现这一点。实现这一点的一个很好的方法是使用一个框架或库,该框架或库可以为您执行大部分功能检测和跨浏览器浏览,例如。还有其他一些功能,如MooTools、Dojo、YUI,但它们的使用不如jQuery广泛,后者是我向您推荐的是,它易于使用,易于学习,非常直观,而且速度非常快


如果您的问题是您拥有的特定javascript,请使用该代码更新您的问题,以便我们可以帮助您使其跨浏览器兼容。

使用类似于jQuery或Prototype的框架。您必须更加具体。发布在其他浏览器中不起作用的代码。您需要提供更多的infoFirefox3.6.16?拜托,伙计!