我一個CakePHP的網站,我使用原型爲所有的AJAX的東西,和jQuery動畫,...奇怪的原型jQuery的問題映射
我已經成功了jQuery的原型問題像這樣:
echo $javascript->link('jquery-1.6.2');
echo $javascript->link('jquery.cookie');
echo $javascript->link('jQueryNoConflict');
echo $javascript->link('prototype');
而且jQuerynoConflict只包含
$.noConflict();
我做了一個小的JS腳本,這表明了與一個定義的類項目,並隱藏其他項目與其他類:
if(jQuery.cookie('isRawPrice')==1){
jQuery('.priceWithoutTva').show();
jQuery('.priceWithTva').hide();
}else{
jQuery('.priceWithoutTva').hide();
jQuery('.priceWithTva').show();
}
這對我的每一個頁面都有效,除了我有一個谷歌地圖項目。我添加這樣的:
function InitMap(elementId, initPosition, initZoom, multiplePolygonsString) {
var pos = initPosition.split(',');
var myLatLng = new google.maps.LatLng(pos[0], pos[1] );
var myOptions = {
zoom:initZoom,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map(document.getElementById(elementId), myOptions);
var multiplePolygons = multiplePolygonsString.split(';');
for(var i=0;i<multiplePolygons.length;i++){
var currentPolygon,match,coordinates = [];
var reg = /\(\s*([0-9.-]+)\s*,\s*([0-9.-]+)\s*\)/g ;
while((match = reg.exec(multiplePolygons[i]))!==null){
coordinates.push( new google.maps.LatLng(+match[1], +match[2]));
}
currentPolygon = new google.maps.Polygon({
paths: coordinates,
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 3,
fillColor: "#FF0000",
fillOpacity: 0.35
});
currentPolygon.setMap(map);
// Add a listener for the click event
google.maps.event.addListener(currentPolygon, 'click', function(event){ showArrays(event, "testInfoBulle"); });
}
infowindow = new google.maps.InfoWindow();
}
(這基本上加載一張地圖,並在定義的區域上創建一些多邊形)。每次顯示時都會生成該地圖。
但是,當我顯示出來,並試圖隱藏/顯示與前面的代碼,我得到這個異常:
Uncaught TypeError: Object #<SVGAnimatedString> has no method 'match'prototype.js:300
Enumerable.eachprototype.js:300
Enumerable.injectprototype.js:372
document.getElementsByClassNameprototype.js:932
Sizzlejquery-1.6.2.js:4869
jQuery.fn.extend.findjquery-1.6.2.js:5188
jQuery.fn.jQuery.initjquery-1.6.2.js:189
jQueryjquery-1.6.2.js:27
updateDisplay.js:26 ---> This is the jQuery('.priceWithoutTva').show(); line
(anonymous function)cat3:3000:643
onclickcat3:3000:644
爲什麼它通過Prototype庫時,他是在jQuery的方法???
我試過了,但沒有改變(我用「myCustomMatch」替換了我的「匹配」) – J4N