开发者

IE 8, object required javascript function

I have been looking all the day about my strange problem.

I have a page, which开发者_如何学Go is loading dynamically content via ajax (with jQuery), but I think it's not a jQuery problem.

The dynamic page contains a javascript function, let's call it "myTestFunction()", without any parameters.

After document.ready (jQuery) or at the end of the page, I call this function. Firefox runs this function. IE 8 said: object required. I think IE can not find the function.

I am very confused about this IE message. My hope is somebody will have an idea about this. How can I tell IE where the function is?

Kindest regards, many thanks for answers. !!!! This Code explains the Problem, running not tested but it should descript the Problem, i hope. Sorry for the strange "code formatting, this is my first example of code in this editor".

 //example of code, a code like this is loaded by our Framework with ajax in a div. 
 <?      //myclass generates the HTML-Output, and generates the Function
         //myTestFunction in an JavaScript Tag see below 
         $myClass = new MyClass('127.0.0.1/application/file.php');
         echo $myClass->renderHTMLcode();
 ?>

<script>
  // alert 1 for me for testing.    
  alert('ende');
 $(document).ready(function() {
     // alert 2, for me , ready event of jQuery has fired  
     alert('ready');
     // function with the problem
      myTestFunction(); 
             }
    );
   <script>        
function myTestFunction() { alert('fromTest'); } ///... } } ?>


you should use, window.myTestFunction()

but this is a very strange error ie is giving you. maybe you should take a look at this

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜