Ошибка на странице
При вводе данных для заказа доставки в IE выдается ошибка JS посмотрите пожалуйста:
внизу слева значок появляется
Вот код xsl шаблона
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="no" method="html" standalone="yes" encoding="Windows-1251"/>
<xsl:template match="/locations">
<script>
var count = '0';
var ListLocation = new Array();
ListLocation[0] = new Array();
ListLocation[0][0] = "..";
<!-- Применяем шаблон для стран, чтобы заполнить JS массив для областей -->
<xsl:apply-templates select="country" mode="JS4location" />
var i = 0;
<xsl:apply-templates select="location" />
var ListCity = new Array();
ListCity[0] = new Array();
ListCity[0][0] = "..";
<!-- Применяем шаблон для областей, чтобы заполнить JS массив для городов -->
<xsl:apply-templates select="location" mode="JS4city" />
<xsl:apply-templates select="city" />
var ListCityArea = new Array();
ListCityArea[0] = new Array();
ListCityArea[0][0] = "..";
<!-- Применяем шаблон для областей, чтобы заполнить JS массив для городов -->
<xsl:apply-templates select="city" mode="JS4cityarea" />
<xsl:apply-templates select="cityarea" />
</script>
<SCRIPT language="JavaScript">
<xsl:text disable-output-escaping="yes">
<!-- функция отображения области в поле выбора по нажатию на страну-->
function choicelocation(id)
{
var CurrentCountry = ListLocation[id];
var CurrentLocation = ListLocation[id];
var LocationCount = ListLocation[id].length;
var SelectItem = document.forms["address"].elements["location"];
SelectItem.length = 0;
var i = 0;
for (key in CurrentLocation)
{
if (CurrentLocation[key])
{
var LocationOption = document.createElement("OPTION");
LocationOption.text = CurrentLocation[key];
LocationOption.value = key;
//if (i == 1)
//{
// LocationOption.setAttribute('selected',"true");
//}
(SelectItem.options.add) ? SelectItem.options.add(LocationOption) : SelectItem.add(LocationOption, null);
}
i++;
}
}
<!-- функция отображения городов в поле выбора по нажатию на область-->
function choicecity(id)
{
var CurrentCity = ListCity[id];
var CityCount = ListCity[id].length;
var SelectItem = document.forms["address"].elements["sel_city"];
SelectItem.length = 0;
for (key in CurrentCity)
{
if (CurrentCity[key])
{
var CityOption = document.createElement("OPTION");
CityOption.text = CurrentCity[key];
CityOption.value = key;
(SelectItem.options.add) ? SelectItem.options.add(CityOption) : SelectItem.add(CityOption, null);
}
}
}
<!-- функция отображения районов в поле выбора по нажатию на область-->
function choicecityarea(id)
{
var CurrentCityArea = ListCityArea[id];
var CityAreaCount = ListCityArea[id].length;
var SelectItem = document.forms["address"].elements["sel_city_area"];
SelectItem.length = 0;
for (key in CurrentCityArea)
{
if (CurrentCityArea[key])
{
var CityAreaOption = document.createElement("OPTION");
CityAreaOption.text = CurrentCityArea[key];
CityAreaOption.value = key;
(SelectItem.options.add) ? SelectItem.options.add(CityAreaOption) : SelectItem.add(CityAreaOption, null);
}
}
}
</xsl:text>
</SCRIPT>
<h1>Адрес доставки</h1>
<div id="news_item">
<form name="address" id="address" method="POST">
<a href="/shop/cart/">Корзина</a>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td>Страна:</td>
<td>
<select id="country" name="country" onchange="choicelocation(this.options[this.selectedIndex].value); choicecity(0); choicecityarea(0);">
<xsl:apply-templates select="country" />
</select>
</td>
</tr>
<tr>
<td>Область:</td>
<td>
<select name="location" id="location" onchange="choicecity(this.options[this.selectedIndex].value); choicecityarea(0);">
<option value="0">..</option>
</select>
<!-- Вызываем функцию определения областей -->
<script type="text/javascript">
selin = document.forms["address"].elements["country"].selectedIndex;
choicelocation(document.forms["address"].elements["country"].options[selin].value);
</script>
</td>
</tr>
<tr>
<td>Город:</td>
<td>
<select name="sel_city" id="sel_city" onchange="choicecityarea(this.options[this.selectedIndex].value)">
<option value="0">..</option>
</select>
</td>
</tr>
<tr>
<td>Район города:</td>
<td>
<select name="sel_city_area">
<option value="0">..</option>
</select>
</td>
</tr>
<tr>
<td>Индекс:</td>
<td><input type="text" size="5" name="index" value=""/></td>
</tr>
<tr>
<td>
Улица, дом, квартира:<br/>
(город, район, если не выбраны)
</td>
<td><input type="text" size="30" name="full_address" value=""/></td>
</tr>
<tr>
<td><input name="step_2" value="Далее >>" type="submit" class="button" /></td>
</tr>
</table>
</form>
</div>
</xsl:template>
<!-- Шаблон заполняет options для стран -->
<xsl:template match="country">
<xsl:choose>
<!-- Если страна задана по умолчанию -->
<xsl:when test="@select=1">
<option value="{@id}" selected=""><xsl:value-of disable-output-escaping="yes" select="name"/></option>
</xsl:when>
<!-- По умолчанию устанавливаем активным "Россия" -->
<xsl:when test="name = 'Россия'">
<option value="{@id}" selected=""><xsl:value-of disable-output-escaping="yes" select="name"/></option>
</xsl:when>
<xsl:otherwise>
<option value="{@id}"><xsl:value-of disable-output-escaping="yes" select="name"/></option>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- JS для областей -->
<xsl:template match="country" mode="JS4location">
ListLocation["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = new Array();
ListLocation["<xsl:value-of disable-output-escaping="yes" select="@id"/>"]["0"] = "..";
</xsl:template>
<!-- JS для городов -->
<xsl:template match="location" mode="JS4city">
ListCity["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = new Array();
ListCity["<xsl:value-of disable-output-escaping="yes" select="@id"/>"]["0"] = "..";
</xsl:template>
<!-- JS для районов городов -->
<xsl:template match="city" mode="JS4cityarea">
ListCityArea["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = new Array();
ListCityArea["<xsl:value-of disable-output-escaping="yes" select="@id"/>"]["0"] = "..";
</xsl:template>
<!--Применяем шаблон для областей -->
<xsl:template match="location">
ListLocation["<xsl:value-of disable-output-escaping="yes" select="@parent"/>"]["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = "<xsl:value-of disable-output-escaping="yes" select="name"/>";
</xsl:template>
<xsl:template match="city">
ListCity["<xsl:value-of disable-output-escaping="yes" select="@parent"/>"]["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = "<xsl:value-of disable-output-escaping="yes" select="name"/>";
</xsl:template>
<!--Применяем шаблон для районов -->
<xsl:template match="cityarea">
ListCityArea["<xsl:value-of disable-output-escaping="yes" select="@parent"/>"]["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = "<xsl:value-of disable-output-escaping="yes" select="name"/>";
</xsl:template>
</xsl:stylesheet>
внизу слева значок появляется
Вот код xsl шаблона
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="no" method="html" standalone="yes" encoding="Windows-1251"/>
<xsl:template match="/locations">
<script>
var count = '0';
var ListLocation = new Array();
ListLocation[0] = new Array();
ListLocation[0][0] = "..";
<!-- Применяем шаблон для стран, чтобы заполнить JS массив для областей -->
<xsl:apply-templates select="country" mode="JS4location" />
var i = 0;
<xsl:apply-templates select="location" />
var ListCity = new Array();
ListCity[0] = new Array();
ListCity[0][0] = "..";
<!-- Применяем шаблон для областей, чтобы заполнить JS массив для городов -->
<xsl:apply-templates select="location" mode="JS4city" />
<xsl:apply-templates select="city" />
var ListCityArea = new Array();
ListCityArea[0] = new Array();
ListCityArea[0][0] = "..";
<!-- Применяем шаблон для областей, чтобы заполнить JS массив для городов -->
<xsl:apply-templates select="city" mode="JS4cityarea" />
<xsl:apply-templates select="cityarea" />
</script>
<SCRIPT language="JavaScript">
<xsl:text disable-output-escaping="yes">
<!-- функция отображения области в поле выбора по нажатию на страну-->
function choicelocation(id)
{
var CurrentCountry = ListLocation[id];
var CurrentLocation = ListLocation[id];
var LocationCount = ListLocation[id].length;
var SelectItem = document.forms["address"].elements["location"];
SelectItem.length = 0;
var i = 0;
for (key in CurrentLocation)
{
if (CurrentLocation[key])
{
var LocationOption = document.createElement("OPTION");
LocationOption.text = CurrentLocation[key];
LocationOption.value = key;
//if (i == 1)
//{
// LocationOption.setAttribute('selected',"true");
//}
(SelectItem.options.add) ? SelectItem.options.add(LocationOption) : SelectItem.add(LocationOption, null);
}
i++;
}
}
<!-- функция отображения городов в поле выбора по нажатию на область-->
function choicecity(id)
{
var CurrentCity = ListCity[id];
var CityCount = ListCity[id].length;
var SelectItem = document.forms["address"].elements["sel_city"];
SelectItem.length = 0;
for (key in CurrentCity)
{
if (CurrentCity[key])
{
var CityOption = document.createElement("OPTION");
CityOption.text = CurrentCity[key];
CityOption.value = key;
(SelectItem.options.add) ? SelectItem.options.add(CityOption) : SelectItem.add(CityOption, null);
}
}
}
<!-- функция отображения районов в поле выбора по нажатию на область-->
function choicecityarea(id)
{
var CurrentCityArea = ListCityArea[id];
var CityAreaCount = ListCityArea[id].length;
var SelectItem = document.forms["address"].elements["sel_city_area"];
SelectItem.length = 0;
for (key in CurrentCityArea)
{
if (CurrentCityArea[key])
{
var CityAreaOption = document.createElement("OPTION");
CityAreaOption.text = CurrentCityArea[key];
CityAreaOption.value = key;
(SelectItem.options.add) ? SelectItem.options.add(CityAreaOption) : SelectItem.add(CityAreaOption, null);
}
}
}
</xsl:text>
</SCRIPT>
<h1>Адрес доставки</h1>
<div id="news_item">
<form name="address" id="address" method="POST">
<a href="/shop/cart/">Корзина</a>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td>Страна:</td>
<td>
<select id="country" name="country" onchange="choicelocation(this.options[this.selectedIndex].value); choicecity(0); choicecityarea(0);">
<xsl:apply-templates select="country" />
</select>
</td>
</tr>
<tr>
<td>Область:</td>
<td>
<select name="location" id="location" onchange="choicecity(this.options[this.selectedIndex].value); choicecityarea(0);">
<option value="0">..</option>
</select>
<!-- Вызываем функцию определения областей -->
<script type="text/javascript">
selin = document.forms["address"].elements["country"].selectedIndex;
choicelocation(document.forms["address"].elements["country"].options[selin].value);
</script>
</td>
</tr>
<tr>
<td>Город:</td>
<td>
<select name="sel_city" id="sel_city" onchange="choicecityarea(this.options[this.selectedIndex].value)">
<option value="0">..</option>
</select>
</td>
</tr>
<tr>
<td>Район города:</td>
<td>
<select name="sel_city_area">
<option value="0">..</option>
</select>
</td>
</tr>
<tr>
<td>Индекс:</td>
<td><input type="text" size="5" name="index" value=""/></td>
</tr>
<tr>
<td>
Улица, дом, квартира:<br/>
(город, район, если не выбраны)
</td>
<td><input type="text" size="30" name="full_address" value=""/></td>
</tr>
<tr>
<td><input name="step_2" value="Далее >>" type="submit" class="button" /></td>
</tr>
</table>
</form>
</div>
</xsl:template>
<!-- Шаблон заполняет options для стран -->
<xsl:template match="country">
<xsl:choose>
<!-- Если страна задана по умолчанию -->
<xsl:when test="@select=1">
<option value="{@id}" selected=""><xsl:value-of disable-output-escaping="yes" select="name"/></option>
</xsl:when>
<!-- По умолчанию устанавливаем активным "Россия" -->
<xsl:when test="name = 'Россия'">
<option value="{@id}" selected=""><xsl:value-of disable-output-escaping="yes" select="name"/></option>
</xsl:when>
<xsl:otherwise>
<option value="{@id}"><xsl:value-of disable-output-escaping="yes" select="name"/></option>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- JS для областей -->
<xsl:template match="country" mode="JS4location">
ListLocation["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = new Array();
ListLocation["<xsl:value-of disable-output-escaping="yes" select="@id"/>"]["0"] = "..";
</xsl:template>
<!-- JS для городов -->
<xsl:template match="location" mode="JS4city">
ListCity["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = new Array();
ListCity["<xsl:value-of disable-output-escaping="yes" select="@id"/>"]["0"] = "..";
</xsl:template>
<!-- JS для районов городов -->
<xsl:template match="city" mode="JS4cityarea">
ListCityArea["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = new Array();
ListCityArea["<xsl:value-of disable-output-escaping="yes" select="@id"/>"]["0"] = "..";
</xsl:template>
<!--Применяем шаблон для областей -->
<xsl:template match="location">
ListLocation["<xsl:value-of disable-output-escaping="yes" select="@parent"/>"]["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = "<xsl:value-of disable-output-escaping="yes" select="name"/>";
</xsl:template>
<xsl:template match="city">
ListCity["<xsl:value-of disable-output-escaping="yes" select="@parent"/>"]["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = "<xsl:value-of disable-output-escaping="yes" select="name"/>";
</xsl:template>
<!--Применяем шаблон для районов -->
<xsl:template match="cityarea">
ListCityArea["<xsl:value-of disable-output-escaping="yes" select="@parent"/>"]["<xsl:value-of disable-output-escaping="yes" select="@id"/>"] = "<xsl:value-of disable-output-escaping="yes" select="name"/>";
</xsl:template>
</xsl:stylesheet>
Делаю сайты на HostCMS! Подробнее по почте anton.yurzanov@gmail.com
Проблему решил сам, оказалось что полсе удаления город в магазине, одна запись осталась в базе данных, немного поковыряв, запись удалил и ошибка пропала!
Делаю сайты на HostCMS! Подробнее по почте anton.yurzanov@gmail.com
Авторизация