iT邦幫忙

0

有關javascript衝突如何解決

我在做一個網站裡面
在這一頁點那個與我聯絡
[http://www.net-doit.com/mst/pdkind.html?id=12
](http://www.net-doit.com/mst/pdkind.html?id=12<br />
)
他會下拉沒有問題也沒錯誤
但是
到這一頁就不行
[http://www.net-doit.com/mst/business.html?id=23
](http://www.net-doit.com/mst/business.html?id=23<br />
)
且有錯誤訊息
訊息: 'style.display' 是 null 或不是一個物件
行: 13
字元: 6
程式碼: 0
URI: http://www.net-doit.com/mst/js/jjs/combo.js

但我只要把

&lt;script type="text/javascript" src="js/jquery-1.5.2.min.js">&lt;/script>

拿掉
下拉就可以但是圖片就沒有辦法換圖
好像是.js會衝突
這會是什麼原因?
謝謝指導

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

11
fillano
iT邦超人 1 級 ‧ 2012-07-31 14:45:05
最佳解答

有點看錯...所以刪掉另外回覆。

簡單地說,盡量不要混用jQuery以及prototype。如果想混用,以你的程式為例,請在載入jquery後呼叫$.noConflict(),這時$會回復成prototype定義的物件,要使用jQuery時,必需使用jQuery來代替$。

你顯示聯絡表單是使用id,以你的程式為例,在prototype是使用$('shelf_wrap'),但是在jQuery是使用$('#shelf_wrap'),Effect.Combo應該是設計給prototype用的東西,但是因為你的$換成jQuery了,所以實際找到的東西其實是個空陣列,他不會有style屬性,就出現了你所看到的錯誤。

我要發表回答

立即登入回答