0
我正在使用jquery帖子來返回一個xml數據集。我最初使用下拉式窗體控件來篩選返回的數據。從jquery中的切換圖像返回值的數組
現在我希望能夠顯示製造商圖標列表,然後讓用戶點擊這些來切換它們的開啓和關閉。
$('#sho').click(function() {
$(this).toggleClass('highlight');
if ($(this).hasClass('highlight')){
$(this).attr('alt','sho');
alert(manufac);
} else {
$(this).attr('alt','');
}});
目前我有切換代碼,以便圖像在點擊時只是獲得一個框。我也用一個值來設置ALT屬性。我希望能夠收集所有具有值的alt屬性並將它們傳遞給我的jquery文章。
function loadXML(so) {
<!-- Clothing Version -->
timestamp = Math.round(new Date().getTime()/1000);
$("#wrapper").html('<div id="load"><img src="http://static.phmotorcyclescom.dev/images/loading.gif" alt="loading" align="center" /></div>');
$("#results").empty();
$.post("http://www.phmotorcycles.current/supportScripts/clothingXML.asp",{
productGroup: "hel",
sortOrder: so,
qt: "group",
ts: timestamp,
manufacturer:$("input:checkbox[name='man[]']:checked").map(function() {
return $(this).val();
}).get()}, <----- I need to replace this section of code
function(xml) {
convertXML(xml);
$("#wrapper").empty();
$('#results').html("Your Product was not found");
},"xml")
}
最終獲取傳遞給設備廠變量的值僅僅是一個逗號分隔值如ARA,笑,沙名單,ARA
是否有人對此有什麼想法請。我已經嘗試使用.each()方法,並設法讓它提醒所有正值,但我無法將它們連接成一個字符串。
$('img').each(function(){
var id = $(this).attr("id");
var altVal = $(this).attr("alt");
if (altVal != '') {
alert($('img#' + id).attr('alt'));
}
});
一如既往的幫助非常感謝。
乾杯 格雷厄姆
好極了,就像一個魅力。非常感謝 – EvilKermitSaurus 2013-05-14 14:43:05