我下載的jQuery-1.9.1庫,然後,我創建在NetBeans中的文件夾,把它稱爲「JS」和所用src屬性:沒有包括的jQuery 1.9.1庫
<script type="text/javascript" src="js/jquery-1.9.1.js">
的問題是如果我包含jquery一些頁面內容沒有被包含,這讓我認爲這個庫沒有被正確包含。
這是完整的javascript代碼:
<script type="text/javascript" src="js/jquery-1.9.1.js">
function write()
{
var loc= document.getElementById("purchase");
var sep= location.href.indexOf("item=");
var item=parseInt(location.href.substring(sep+5,location.href.length));
switch(item)
{
case 1:
string= "Opere orchestrali vol. 1";
break;
case 2:
string= "Concerti per pianoforte n.1,n.4";
break;
case 3:
string= "Concerto di Capodanno 2013";
break;
case 4:
string= "Viva Verdi. Ouvertures & Preludes";
break;
case 5:
string= "Jaywalkin";
break;
case 6:
string= "The Real Life ";
break;
case 7:
string= "Shango";
break;
case 8:
string= "Complete Soul";
break;
case 9:
string= "Old Yellow Moon";
break;
case 10:
string= "In Time";
break;
case 11:
string= "Greatest Country Love Songs";
break;
case 12:
string= "Spring Break... here to Party";
break;
}
if(string !== undefined)
{
loc.innerHTML= "Acquisto effettuato: " + string;
}
}
</script>
的行爲非常簡單:它只是讀取名爲「項」 GET參數,並根據它的值(從1到12),它把標題在html標籤內的光盤。
如果我不包括jquery它會完美的工作,如果我包含jquery它不起作用,它不會將任何東西放在標籤內。