开发者

Execution error on Mozilla (activexobject is not defined) [closed]

开发者 https://www.devze.com 2022-12-11 05:12 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

My source is working in IE but not in Mozilla. Please help me.

<script type="text/javascript">
<!--
var adOpenDynamic = 2;
var adLockOptimistic = 3;

/* Path of database.
*/
var strDbPath = "..\\SRVGdb.mdb";

/*
Here is the ConnectionString for Microsoft Access.
If you want to use SQL or other databases, you hav to change the connection string..
eg: SQL => var conn_str = "Provider=sqloledb; Data Source=itdev; Initial Catalog=pubs; User ID=sa;Password=yourpassword";
*/
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDbPath;

function getAdoDb(strAdoType) {
    if (window.ActiveXObject) {
        return new ActiveXObject(strAdoType);
    }
    else {
        return ActiveXObject(strAdoType);
    }
}

function showReports() {
    try {
        var tablevar="<table width=\"100%\" border=\"1\">"
                    +"  <tr><td></td>"
                    +"  </tr>";

        //Database Connection
        var conn = getAdoDb("ADODB.Connection");
        conn.open(conn_str, "", "");

       //Recordset
       var rs = new ActiveXObject("ADODB.Recordset");
       strQuery = "SELECT * FROM GuestBook";
       rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);

       if (!rs.bof) {
           rs.MoveFirst();

           while(!rs.eof) {

               if(document.layers){
            document.getElementById("one").open();

            document.getElementById("one").close();
               }
           else {

                    tablevar+="  <tr>"
                    +"    <td>"+"Sur Name: <br> Fore Name: <br> Home Address: <br> PinCode: <br> Contact Number: <br> E-mail: <br> Date of Birth: <br>  Nationality: <br> University: <br> Available Timings: <br> Interested Courses: <br> Other Courses:  <br> Expected Money:  <br> Any More Information: <br> 开发者_Python百科"+"</td>"
                    +"    <td>"+rs.fields(0).value+"<br>"+rs.fields(1).value+"<br>"+rs.fields(2).value+"<br>"+rs.fields(3).value+"<br>"+rs.fields(4).value+"<br>"+rs.fields(5).value+"<br>"+rs.fields(6).value+"<br>"+rs.fields(7).value+"<br>"+rs.fields(8).value+"<br>"+rs.fields(9).value+"<br>"+rs.fields(10).value+"<br>"+rs.fields(11).value+"<br>"+rs.fields(12).value+"<br>"+rs.fields(13).value+"<br></td>"
      +"  </tr>";

                document.getElementById("one").innerHTML=tablevar;

                }

                rs.MoveNext();
            }
      }
      else{

          if(document.layers){
         document.getElementById("one").open();

         document.getElementById("one").close();
          }
          else{

        document.all("one").innerHTML="No Records To Display.";

          }
          //No Records.

      }
      conn.close();


       tablevar+= "</table>";

} catch(ex) {
     alert(ex.message);
}
}

//-->
</script>

thanks in advance


ActiveXObject is IE specific and you wont be able to execute that in a non IE browser.


Check this question:

Is there a way to run ActiveX components in Firefox through the use of a plugin?

0

精彩评论

暂无评论...
验证码 换一张
取 消