'$'是未定义JavaScript错误 [英] '$' is undefined javascript error
本文介绍了'$'是未定义JavaScript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<script type="text/javascript">
$(function() {
$('#WaterMark').draggable(
{
start: function(e, ui) {
},
cursor: 'move',
zIndex: 2700,
revert: 'invalid',
containment: '#OriginalImageContainer'
});
$('#OriginalImage').droppable({
hoverClass: 'DroppableOver',
drop: InitializeWaterMark
})
});
var InitializeWaterMark = function() {
var position = $('#WaterMark').position();
var imgPosition = $('#OriginalImageContainer').position();
document.getElementById('xpos').value = position.left - imgPosition.left;
document.getElementById('ypos').value = position.top - imgPosition.top;
}
</script>
这是JavaScript的$ C $词得到了关于在asp.net网页拖拽和图像的降采样...但它返回一个错误,指出$未定义 ..请帮助我出去
this is a sample javascript code i got regarding drag and drop of images in a asp.net webpage...But it returns a error stating '$' is undefined..please help me out
推荐答案
在猜测,我说你失踪的库来支持脚本(可能是jQuery的)。
At a guess, I'd say you were missing the library to support that script (probably jQuery).
您需要在为了得到你正在寻找的可拖动功能的JavaScript框架的引用。
You need to include a reference to the JavaScript framework in order to get the draggable functionality you're looking for.
尝试添加以下到您的网页(之前在您的示例脚本块):
Try adding the following to your page (before the script block in your example):
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.js"></script>
这篇关于'$'是未定义JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文