【发布时间】:2011-08-14 17:54:55
【问题描述】:
我正在使用 javascript 进行开发,并且希望仅在验证条件时才插入脚本。
例如:
var a = exampleVariable;
if (a == conditionIwant) {
// append to head:
<script src="http://code.jquery.com/jquery-1.5.js"> </ script>
}; //or something like this
如何仅在条件为真时插入 jquery.js?
【问题讨论】:
-
您是否可以使用其他技术 - PHP、ASP 等。如果可能的话,这确实是您应该在服务器端做的事情。
标签: javascript jquery get conditional-statements