简体   繁体   中英

Javascript function error Uncaught TypeError: Cannot set property 'target' of undefined

Javascript error coming don't know how to solve this on live server its working fine . now i am upgrading version of CodeIgniter so its not working on my code . but good working on 1.72

<script language="javascript" type="text/javascript" >
     function doPostBack(col_id,ord_id,off_set) 
     {
            var theform;
            if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
                theform = document.searchForm;
            }
            else {
                theform = document.forms["searchForm"];
            }
            theform.href="href='http://www.google.com';"
            theform.target='_self';
            if(col_id!=null || col_id!=""){
            theform.COL_ID.value = col_id;
            }
            if(ord_id!=null || ord_id!=""){
            theform.ORD_ID.value = ord_id;
            }
            if(off_set!=null || off_set!=""){
            theform.OFF_SET.value = off_set;
            }
            theform.submit();
      }
      </script>

best solution for this is create the helpers and rest add code in MY_Controller. those methods you want to run automatic in controller so that you can call those methods in view

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM