ECshop js cannot obtain default attributes in IE browser

Source: Internet
Author: User


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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.