下面是如何在控件中使用特定版本的 jQuery(之前已在页面上分配)并将其设置回之前的版本以获取剩余控件。
我知道这并不理想,但稍后会清理 who 应用程序。
提前致谢。
<!-- This would be set earlier on the page. Possibly at page level or in a previous control -->
<script type="text\javascript" src='jquery-1.7.1.js'></script>
<!-- This would at the start of the control -->
<script>
var $origJquery = null; //Should be unique var name for the control
if(typeof jQuery != 'undefined')
$origJquery = jQuery.noConflict();
</script>
<script type="text\javascript" src='jquery-1.7.2.js'></script>
<script>
var $newJquery = jQuery.noConflict();
//Can use $newJquery here
</script>
<script>
//Set back when finished at end of control
if($origJquery != null)
{
$ = $origJquery;
$origJquery = null;
}
</script>