Javascript Jquery向DOM对象追加额外的#
我在IE9中遇到以下错误 SCRIPT5022:语法错误,无法识别的表达式:##chart1 jquery-2.0.3.min.js,第4行字符14519 我不知道为什么给出下面显示的代码。很明显,我没有将它添加到HTML字符串中,当我在jqplot调用中引用它时,只有1。那么,它为什么要纠正这个错误呢Javascript Jquery向DOM对象追加额外的#,javascript,jquery,Javascript,Jquery,我在IE9中遇到以下错误 SCRIPT5022:语法错误,无法识别的表达式:##chart1 jquery-2.0.3.min.js,第4行字符14519 我不知道为什么给出下面显示的代码。很明显,我没有将它添加到HTML字符串中,当我在jqplot调用中引用它时,只有1。那么,它为什么要纠正这个错误呢 function createGraph() { var HTMLstring = '<!DOCTYPE html>\n'; HTMLstring += '<H
function createGraph() {
var HTMLstring = '<!DOCTYPE html>\n';
HTMLstring += '<HTML>\n';
HTMLstring += '<HEAD>\n';
HTMLstring += '<TITLE> Frequency Graph</TITLE>\n';
HTMLstring += '<!--[if lt IE 9]><script src="js/excanvas.js"></script><![endif]-->\n';
HTMLstring += '<script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>\n';
HTMLstring += '</HEAD>\n';
HTMLstring += '<BODY>\n';
HTMLstring += '<div><span>Moused Over: </span><span id="infomouseover">Nothing</span></div>\n';
HTMLstring += '<div><span>Clicked: </span><span id="infoclicked">Nothing</span></div>\n';
HTMLstring += '<div id="chart1" style="margin-top:20px; margin-left:20px; width:300px; height:300px;"></div>\n';
HTMLstring += '</BODY>\n';
HTMLstring += '</HTML>';
newwindow = window.open();
newdocument = newwindow.document;
newdocument.write(HTMLstring);
$(document).ready(function () {
freqchart = $.jqplot('#chart1', [
[
[2, 1],
[4, 2],
[6, 3],
[3, 4]
],
[
[5, 1],
[1, 2],
[3, 3],
[4, 4]
],
[
[4, 1],
[7, 2],
[1, 3],
[2, 4]
]
], {
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
pointLabels: {
show: true,
location: 'e',
edgeTolerance: -15
},
shadowAngle: 135,
rendererOptions: {
barDirection: 'horizontal'
}
},
axes: {
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer
}
}
});
$('#chart1').bind('jqplotDataHighlight',
function (ev, seriesIndex, pointIndex, data) {
$('#infomouseover').html('series: ' + seriesIndex + ', point: ' + pointIndex + ', data: ' + data + ', pageX: ' + ev.pageX + ', pageY: ' + ev.pageY);
}
);
$('#chart1').bind('jqplotDataClick',
function (ev, seriesIndex, pointIndex, data) {
$('#infoclicked').html('series: ' + seriesIndex + ', point: ' + pointIndex + ', data: ' + data + ', pageX: ' + ev.pageX + ', pageY: ' + ev.pageY);
}
);
$('#chart1').bind('jqplotDataUnhighlight',
function (ev) {
$('#infomouseover').html('Nothing');
}
);
});
}
函数createGraph(){
var HTMLstring='\n';
HTMLstring+='\n';
HTMLstring+='\n';
HTMLstring+='频率图\n';
HTMLstring+='\n';
HTMLstring+='\n';
HTMLstring+='\n';
HTMLstring+='\n';
HTMLstring+='Moused Over:Nothing\n';
HTMLstring+='单击:无\n';
HTMLstring+='\n';
HTMLstring+='\n';
HTMLstring+='';
newwindow=window.open();
newdocument=newwindow.document;
newdocument.write(HTMLstring);
$(文档).ready(函数(){
freqchart=$.jqplot(“#chart1”[
[
[2, 1],
[4, 2],
[6, 3],
[3, 4]
],
[
[5, 1],
[1, 2],
[3, 3],
[4, 4]
],
[
[4, 1],
[7, 2],
[1, 3],
[2, 4]
]
], {
系列默认值:{
渲染器:$.jqplot.blunderer,
点标签:{
秀:没错,
地点:'e',
边缘公差:-15
},
阴影角:135,
渲染器选项:{
B方向:“水平”
}
},
轴线:{
亚克斯:{
渲染器:$.jqplot.CategoryAxisRenderer
}
}
});
$('#chart1').bind('jqplotDataHighlight',
函数(ev、序列索引、点索引、数据){
$('infomouseover').html('series:'+seriesIndex+',point:'+pointIndex+',data:'+data+',pageX:'+ev.pageX+',pageY:'+ev.pageY');
}
);
$(“#图表1”).bind('jqplotDataClick',
函数(ev、序列索引、点索引、数据){
$('infoclicked').html('series:'+seriesIndex+',point:'+pointIndex+',data:'+data+',pageX:'+ev.pageX+',pageY:'+ev.pageY);
}
);
$('#chart1').bind('jqplotDataUnhighlight',
功能(ev){
$('infomouseover').html('Nothing');
}
);
});
}
jqPlot()
不需要CSS样式选择器来查找Id。它自己处理Id,因此当前它会两次查找带有附加的
的#chart1
<script>
//This will look for #chart1
$.jqplot('chart1', [data], options );
</script>
//这将查找图表1
$.jqplot('chart1',[data],选项);
“使用目标的id调用$.jqplot()
插件,创建实际绘图”
jqPlot()
不需要CSS样式选择器来查找Id。它自己处理Id,因此当前它会两次查找带有附加的
的图表1
<script>
//This will look for #chart1
$.jqplot('chart1', [data], options );
</script>
//这将查找图表1
$.jqplot('chart1',[data],选项);
“使用目标的id调用$.jqplot()
插件,创建实际绘图”
jqPlot()
不需要CSS样式选择器来查找Id。它自己处理Id,因此当前它会两次查找带有附加的
的图表1
<script>
//This will look for #chart1
$.jqplot('chart1', [data], options );
</script>
//这将查找图表1
$.jqplot('chart1',[data],选项);
“使用目标的id调用$.jqplot()
插件,创建实际绘图”
jqPlot()
不需要CSS样式选择器来查找Id。它自己处理Id,因此当前它会两次查找带有附加的
的图表1
<script>
//This will look for #chart1
$.jqplot('chart1', [data], options );
</script>
//这将查找图表1
$.jqplot('chart1',[data],选项);
“使用目标的id调用$.jqplot()
插件,创建实际绘图”
jqplot将元素id作为参数而不是id选择器,因此
$。jqplot(“#chart1”,
应该是$。jqplot('chart1',
等等
jqplot将元素id作为参数而不是id选择器,因此
$。jqplot(“#chart1”,
应该是$。jqplot('chart1',
等)
jqplot将元素id作为参数而不是id选择器,因此
$。jqplot(“#chart1”,
应该是$。jqplot('chart1',
等)
jqplot将元素id作为参数而不是id选择器,因此
$。jqplot(“#chart1”,
应该是$。jqplot('chart1',
等)