Javascript代码没有在谷歌浏览器和IE浏览器中运行,但在mozilla中运行 [英] Javascript code not running in google chrome and IE but running in mozilla

查看:106
本文介绍了Javascript代码没有在谷歌浏览器和IE浏览器中运行,但在mozilla中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我遇到的问题是我的javascript代码仅在mozilla中运行,但在谷歌浏览器和IE浏览器中运行。请告诉我该怎么做才能在所有主流浏览器中运行。 。

这是搜索在另一页上打开按钮的页面

< script type =text / javascript>

 $(document).ready(function(){

$(' .btnSelectCSS')。click(function(){
var pmxid = $( this )。attr( PMXId);
var name = $( this )。attr( FullName);
// alert (pmxi d);
// window.opener.document.aspnetForm.ctl00_contentArea_txtlinemanager.value = pmxid ;
// var dataArray = [pmxid,pmxname];

// if(window.opener){
// window.opener.returnValue = dataArray;
/ / }
window.returnValue = [pmxid,name];
window.close();
});
});
< / script >





以下是上页背后的代码



< pre lang =cs> if (selectButton!= null && employee!= null
{
string javascript = string .Format( javascript:SelectPMxId({0},{1});,employee.PMxId,employee.FullName);

employee.PMxId);
selectButton.Attributes.Add( onClick,javascript);

}







以下是我需要拨打此电话的地方页面..

 <   script     type   =  text / javascript >  
函数OpenPopup(showPopupFor){
var popupGenerator = null;
var trusteeName = null;
var empidhiddenfield = null;
var trustnamehiddenfield = null;
popupGenerator = document.getElementById(<% = txtlinemanager.ClientID %> );
trusteeName = document.getElementById(<% = txtTrusteeName.ClientID %> );
empidhiddenfield = document.getElementById(<% = textlinemangr.ClientID %> );
trustnamehiddenfield = document.getElementById(<% = texttrustname.ClientID %>



if(popupGenerator == null)return false;
var url =masterdata / employee / employeesearch.aspx;
var params = new Array(popupGenerator.Value);
var popupSetting =center:yes; scroll:no; edge = raised; status:no; resizable:no; dialogWidth:400px; dialogHeight:415px;
var prevReturnValue = window.returnValue;
window.returnValue = undefined;
var pmx = window.showModalDialog(url,params,popupSetting);
if(pmx == undefined){
pmx = window.returnValue;
}
window.returnValue = prevReturnValue;
if(pmx == undefined || pmx == null){
popupGenerator.value =;
}
else {
// popupGenerator.value = pmx.toString();
popupGenerator.value = pmx [0] .toString();
trusteeName.value = pmx [1] .toString();
empidhiddenfield.value = pmx [0] .toString();
trustnamehiddenfield.value = pmx [1] .toString();
}
//popupGenerator.focus();
返回false;
}

< / script >



请告诉我该如何才能正常工作..

解决方案

(document).ready(function(){


' 。btnSelectCSS')。click(function(){
var pmxid =


this )。attr( PMXId);
var name =


Hello,
I am having an problem that my javascript code runs only in an mozilla but not in google chrome and IE.please tell whould i do sothat in it can run in all major browsers..
This is search which page which open up on button on another page
<script type="text/javascript">

$(document).ready(function() {

            $('.btnSelectCSS').click(function() {
                var pmxid = $(this).attr("PMXId");
                var name = $(this).attr("FullName");
                //alert(pmxid);
                //window.opener.document.aspnetForm.ctl00_contentArea_txtlinemanager.value = pmxid;
                //var dataArray = [pmxid, pmxname];

                //                    if (window.opener) {
                //                        window.opener.returnValue = dataArray;
                //                    }
                window.returnValue = [pmxid, name];
                window.close();
            });
        });
    </script>



Below is the code behind of above page

if (selectButton != null && employee != null)
           {
               string javascript = string.Format("javascript:SelectPMxId({0},{1});", employee.PMxId, employee.FullName);

            employee.PMxId);
               selectButton.Attributes.Add("onClick", javascript);

           }




And below is the where i need to call this page..

<script type="text/javascript">
        function OpenPopup(showPopupFor) {
            var popupGenerator = null;
            var trusteeName = null;
            var empidhiddenfield = null;
            var trustnamehiddenfield = null;
            popupGenerator = document.getElementById("<%= txtlinemanager.ClientID %>");
            trusteeName = document.getElementById("<%= txtTrusteeName.ClientID %>");
            empidhiddenfield = document.getElementById("<%= textlinemangr.ClientID %>");
            trustnamehiddenfield = document.getElementById("<%= texttrustname.ClientID %>")



            if (popupGenerator == null) return false;
            var url = "masterdata/employee/employeesearch.aspx";
            var params = new Array(popupGenerator.Value);
            var popupSetting = "center:yes;scroll:no;edge=raised;status:no;resizable:no;dialogWidth:400px;dialogHeight:415px";
            var prevReturnValue = window.returnValue;
            window.returnValue = undefined;
            var pmx = window.showModalDialog(url, params, popupSetting);
            if (pmx == undefined) {
                pmx = window.returnValue;
            }
            window.returnValue = prevReturnValue;
            if (pmx == undefined || pmx == null) {
                popupGenerator.value = "";
            }
            else {
                // popupGenerator.value = pmx.toString();
                popupGenerator.value = pmx[0].toString();
                trusteeName.value = pmx[1].toString();
                empidhiddenfield.value = pmx[0].toString();
                trustnamehiddenfield.value = pmx[1].toString();
            }
            //popupGenerator.focus();
            return false;
        }

    </script>


please tell me how should i do this to work it fine..

解决方案

(document).ready(function() {


('.btnSelectCSS').click(function() { var pmxid =


(this).attr("PMXId"); var name =


这篇关于Javascript代码没有在谷歌浏览器和IE浏览器中运行,但在mozilla中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆