2011-09-15 93 views
-1

写在header.php文件,下面是用来Zend公司和jQuery,如何在Zend的

<script type="text/javascript" src="http://example.com/library/includes/jQuery142.js"> 
</script> // jquery 
<script type="text/javascript" src="http://example.com/library/includes/jqueryautoiframe.js"> 
</script> // plugin iFrame Sizing 

在下面的代码视图文件,我怎么在把下面的Zend?我用下面的代码,但不工作。

<iframe src="blabla"></iframe> 
<script> 
$('iframe').iframeAutoHeight(); //iframeAutoHeight is the function in jqueryautoiframe.js 
</script> 
+0

你gettinng在Firebug的错误 –

回答

3

您需要等到文档准备好之前,你可以使用任何JS

试试这个:

<script> 
$(function() { 
    $('iframe').iframeAutoHeight(); //iframeAutoHeight is the function in jqueryautoiframe.js 
}); 
</script> 
+0

感谢队友,试过了,没有工作。 –

+0

您是否在控制台中收到任何类型的错误? – wesbos

+0

我猜想,因为iframe标记位于脚本之上,因此不需要将其放入准备好的处理程序中。 –

-1

尝试

<iframe src="http://google.com"></iframe> 
<script type="text/javascript"> 
$('iframe').iframeAutoHeight(); //iframeAutoHeight is the function in jqueryautoiframe.js 
</script> 

你的IFRAME来源是“布拉布拉'你有意地把它?

-1

尝试

<?php 
$this->headScript() 
->appendScript(
    <<<'BODY' 
    $('iframe').iframeAutoHeight(); 
    }); 
BODY 
); 
?>