Всем привет.
Подкажите, пожалуйста.
Мне нужно чтобы при нажатии на кнопку "Оформить заказ" кнопка скрывалась и отображался preloader.
gif загружена на хостинг.
Пробовал прописать следующий код
<div style="position: absolute;display: none;" id="gif"><img src="i/cart.gif"></div>
<input value="Оформить заказ" type="submit" class="button" onclick="$(this).hide();$('#gif').show();" />
Но выдает ошибку.
Пока прописал такой: <input value="Оформить заказ" type="submit" class="button" onclick="this.style.display='none';" />
В итоге кнопка скрывается, предотвращает от второго нажатия. Но как вывести preloader?
XML шаблон
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hostcms="http://www.hostcms.ru/"
exclude-result-prefixes="hostcms">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml" />
<!-- МагазинАдресДоставки -->
<xsl:template match="/shop">
<form method="POST" name="contact_form" onsubmit="return add_data ( );">
<select class="dnone" id="shop_country_id" name="shop_country_id"><option value="175" selected="selected">Россия</option></select>
<select class="dnone" name="shop_country_location_id" id="shop_country_location_id"><option value="1" selected="selected">Москва и Московская обл.</option></select>
<h1>Адрес доставки</h1>
<div class="comment shop_address">
<div class="center" id="error_cart"></div>
<div class="row">
<div class="caption">Доставить в:<span class="red_dot">*</span></div>
<div class="field">
<select name="shop_country_location_city_id" id="shop_country_location_city_id">
<option value="0" selected="selected">…</option>
<option value="1">Москву</option>
<option value="68">Москву за МКАД</option>
</select>
</div>
</div>
<div class="row">
<div class="caption">Адрес доставки, код домофона, этаж:<span class="red_dot">*</span></div>
<div class="field">
<input type="text" style="width:313px;" id="cart_adress" name="address" value="{/shop/siteuser/address}" class="width2" />
</div>
</div>
<div class="row">
<div class="caption">Фамилия, Имя:</div>
<div class="field">
<input type="text" style="width:150px;" class="width1" name="surname" value="{/shop/siteuser/surname}" />
<input type="text" style="width:150px;" class="width1" name="name" value="{/shop/siteuser/name}" />
</div>
</div>
<div class="row">
<div class="caption">Телефон:<span class="red_dot">*</span></div>
<div class="field">
<input type="text" style="width:313px;" id="cart_phone" name="phone" value="{/shop/siteuser/phone}" class="width2" />
</div>
</div>
<div class="row" id="odd_from_wrap">
<div class="caption">Приготовить сдачу с:</div>
<div class="field">
<input type="text" style="width:113px;" id="odd_from" name="odd_from" value="{/shop/siteuser/odd_from}" class="width2" />
</div>
</div>
<div class="row" id="persons_cnt_wrap">
<div class="caption">Количество персон:</div>
<div class="field">
<input type="text" style="width:113px;" id="persons_cnt" name="persons_cnt" value="{/shop/siteuser/persons_cnt}" class="width2" />
</div>
</div>
<div class="row">
<div class="caption">Комментарий:</div>
<div class="field">
<textarea style="width:313px;height:100px;border:1px #ccc solid;padding:4px;" name="description" id="description" class="width2"></textarea>
</div>
</div>
<div class="row">
<input name="step" value="4" type="hidden" />
<input value="Оформить заказ" type="submit" class="button" onclick="this.style.display='none';" />
</div>
</div>
</form>
<SCRIPT type="text/javascript" language="JavaScript">
$(function() {
$.loadLocations('<xsl:value-of select="/shop/url" />cart/', $('#shop_country_id').val());
});
</SCRIPT>
</xsl:template>
<xsl:template match="shop_country">
<option value="{@id}">
<xsl:if test="/shop/shop_country_id = @id">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name" />
</option>
</xsl:template>
</xsl:stylesheet>