After beautifying product attributes
All attributes are in type = hidden format.
The default value is checked = true.
IE still cannot obtain the attr value when loading for the first time.
Solution:
Add a default value defaultChecked to the goods. dwt attribute
For example:
<! -- {Foreach from = $ spec. values item = value key = key} -->
<Span class = "fl junma {if $ key eq 0} hover {/if}" name = "spec _ {$ spec_key}" value = "{$ value. id} "> {$ value. label}
</Span>
<Input type = "hidden" name = "spec _ {$ spec_key}" value = "{$ value. id} "{if $ key eq 0} checked =" true "defaultChecked =" true "{/if}>
<! -- {/Foreach} -->
In common. js
Modify js:
/**
* Obtain the attributes of the selected product.
*/
Function getSelectedAttributes (formBuy)
{
Var spec_arr = new Array ();
Var j = 0;
For (I = 0; I <formBuy. elements. length; I ++)
{
Var prefix = formBuy. elements [I]. name. substr (0, 5 );
If (prefix = 'Spec _'&&(
(FormBuy. elements [I]. type = 'den den '| formBuy. elements [I]. type = 'checkbox') & formBuy. elements [I]. checked) |
FormBuy. elements [I]. tagName = 'select' | formBuy. elements [I]. getAttribute ('defaultchecked ')))
{
Spec_arr [j] = formBuy. elements [I]. value;
J ++;
}
}
Return spec_arr;
}