Okay, ich bin total verwirrt auf diesem.
Ich habe ein Skript, das eine Reihe von Werten aus einem JSON-Objekt empfängt und eine Reihe von Kontrollkästchen und entweder aktiviert bzw. deaktiviert eine diese Kontrollkästchen auf der Grundlage ihrer Werte.
Das Skript funktioniert einwandfrei in IE8, Firefox3, etc ... etc ...
Jedoch...
In IE7 schlägt das Skript die Kontrollkästchen abhaken. Es zeigt keine Fehler und von dem, was ich sagen kann, wird das Skript einfach gut. Ich überprüfe einfach nicht das Kontrollkästchen, und ich weiß nicht, warum ...
shoppingCart['Update_Stock_Item_0_NRD%5FHAT2'] = {
'propeller': {
'label' : 'propeller',
'optionValues' : {
'on' : {
'selected': 'selected'
},
'off' : {
'selected': ''
},
'' : new String()
}
},
'sunLogo': {
'label' : 'sunLogo',
'optionValues' : {
'on' : {
'selected': 'selected'
},
'off' : {
'selected': ''
},
'' : new String()
}
},
'MSLogo': {
'label' : 'sunLogo',
'optionValues' : {
'on' : {
'selected': 'selected'
},
'off' : {
'selected': ''
},
'' : new String()
}
}
};
Funktion stockInit () {alert ( BEGIN: stockInit ()); // TODO: Sie werden eine „Ein“ und eine „Aus“ Option empfangen // Man wird ein „ausgewählt“ Attribut von „ausgewählt“, // und die anderes wird ein „ausgewählt“ Attribut „“ // // die Option, die das „ausgewählt“ Attribut „“ // hat eine Checkbox generieren , die nicht überprüft wird. // // Die Option, die das „ausgewählte Attribut‚ausgewählt‘hat // wird eine Checkbox erzeugen , die überprüft wird. //
// Warum? Sie fragen ... denn das ist die Sache , nur die Art und Weise ist , ist // Setup.
var optionContainer = document.getElementById(item + _optionContainer);
for(var option in shoppingCart[item])
{
if(option != blank)
{
// // console.log(option: + option);
var currentOption = shoppingCart[item][option]['optionValues'];
// // console.log(currentOption['on']['selected']: + currentOption['on']['selected']);
// // console.log(currentOption['off']['selected']: + currentOption['off']['selected']);
// Really you only have to check the one, but just to be through-o
var selected = (currentOption['on']['selected'] == 'selected') ? true : false;
selected = (currentOption['off']['selected'] == 'selected') ? false : true;
var label = document.createElement(LABEL);
var labelText = document.createTextNode(shoppingCart[item][option]['label']);
var optionInput = document.createElement(INPUT);
var hiddenInput = document.createElement(INPUT);
optionInput.setAttribute(type, checkbox);
optionInput.checked = selected;
optionInput.setAttribute(id, option);
alert(optionInput.id);
alert(optionInput.checked);
hiddenInput.setAttribute(type, hidden);
hiddenInput.setAttribute(name, option);
hiddenInput.setAttribute(id, option + _hiddenValue);
hiddenInput.setAttribute(value, (optionInput.checked) ? on : off);
label.appendChild(optionInput);
label.appendChild(labelText);
label.appendChild(hiddenInput);
(function(id)
{
optionInput.onclick = function() {
var hiddenInput = document.getElementById(id + _hiddenValue);
hiddenInput.setAttribute(value, (this.checked == true) ? on : off);
alert(this.id: + this.id);
alert(this.checked: + this.checked);
}
})(optionInput.id);
optionContainer.appendChild(label);
}
}
// // console.log(processing item of + item + complete);
}
alert(END: stockInit());
}
Und bitte nicht fragen, warum ich die Dinge so zu tun ... alles, was ich kann wirklich sagen, ist, dass ich keinen Zugriff auf den Back-End-Code haben Sie ... so bekomme ich, was ich bekomme ...













