【发布时间】:2012-04-29 09:50:35
【问题描述】:
如果页面中尚未包含 jquery,我想将其包含在文件中。 我该怎么做?
我写了这个,但它给出了不想要的输出。
<script type="text/javascript">
if ('undefined' == typeof window.jQuery) {
// jQuery not present
// alert("Jquery Unavailable");
<?php echo '<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js"></script>'; ?>
} else {
// jQuery present
alert("Jquery Available");
}
</script>
【问题讨论】:
标签: javascript php jquery