html解析错误无法在子元素关闭之前修改父容器元素

时间:2010-03-04 08:31:01

标签: php javascript cross-browser

有人可以帮助我吗? 抱歉,我的英文......

这是生成错误的php代码(仅限Internet Explorer 8,on firefox,opera和chrome工作正常):

<!--    SHIPPING ADDRESS   -->
         <h4 id='onCheckoutShipping'><?php echo JText::_("Indirizzo di spedizione") ?></h4>
         <?php
         $baseurl = "index.php?option=com_tienda&format=raw&controller=addresses&task=getAddress&address_id=";
         $url = JRoute::_($baseurl . @$this->shipping_address->address_id);
            if (!empty($this->addresses))
            {
             $shipattribs = array('class' => 'inputbox',    'size' => '1','onchange' => "tiendaDoTask('$baseurl'+this.options[this.selectedIndex].value, 'shippingDefaultAddress', '')");
             echo TiendaSelect::address( JFactory::getUser()->id, @$this->shipping_address->address_id, 'shipping_address_id', 2, $shipattribs, 'shipping_address_id', false );
             if(count($this->addresses) == 1){
              echo "<input type=\"hidden\" id=\"shipping_address_id\" name=\"shipping_address_id\" value=\"" . @$this->shipping_address->address_id . "\" />";
             }
}?>

            <script type="text/javascript">tiendaDoTask('<?php echo $url ?>', 'shippingDefaultAddress', '');</script>

         <p id="shippingDefaultAddress"></p>

        </td>
        <td style="width: 50px; text-align: left;">
            <!--    BILLING ADDRESS   -->             
         <h4 id='onCheckoutBilling'><?php echo JText::_("Indirizzo di fatturazione") ?></h4>
         <?php 
             $url = JRoute::_($baseurl . @$this->billing_address->address_id);
             if (!empty($this->addresses))
             {
                 $billattribs = array('class' => 'inputbox',    'size' => '1','onchange' => "tiendaDoTask('$baseurl'+this.options[this.selectedIndex].value, 'billingDefaultAddress', '')");
                 echo TiendaSelect::address( JFactory::getUser()->id, @$this->billing_address->address_id, 'billing_address_id', 1, $billattribs, 'billing_address_id', false );
              if(count($this->addresses) == 1)
              {
                echo "<input type=\"hidden\" id=\"billing_address_id\" name=\"billing_address_id\" value=\"" . @$this->billing_address->address_id . "\" />";
              }
 }?>
         <script type="text/javascript">tiendaDoTask('<?php echo $url ?>', 'billingDefaultAddress', '');</script>
         <p id="billingDefaultAddress"></p>
        </td>
    </tr>
    </table>        

1 个答案:

答案 0 :(得分:1)

关闭后尝试放置最后一个脚本块 您的tiendaDoTast()可能会尝试修改此标记,并且IE在修改的未关闭标记方面存在问题。

您也可以将span放在那里,而不是将脚本放在流程中并在脚本末尾访问它们。