Есть скрипт, НЕ работает Кнопка "Отправить", работает как якорь, тоесть по нажатию перескакивает на верх страницы, что можно сделать чтобы все нажималось как положено?
Скрипт писал не Я что изменить в нем не знаю, да и не силен я в этом.
Да, в IE скрипт работает, а вот в других браузерах не хочет.
<script>
function processText(txt){
processedText = '';
for (i=0; i<txt.length; i++){
if (txt.charAt(i) == '"') processedText += '\\"';
else if (txt.charAt(i) == '\r') processedText += '%0d';
else if (txt.charAt(i) == '\n') processedText += '%0a';
else if (txt.charAt(i) == ' ') processedText += '%20';
else processedText += txt.charAt(i);
}
return processedText;
}
function sethref(){
a=processText('mailto:znaki.rk@rambler.ru?subject=Анкета: '+document.getElementById('name').value+'&body=1.Название предприятия: '+document.getElementById('name').value+'%0d%0a%0d%0a2.Сфера деятельности:%0d%0a'+document.getElementById('sfera').value+'%0d%0a%0d%0a3.Адрес:%0d%0a'+document.getElementById('adres').value+'%0d%0a%0d%0a4.Телефон:%0d%0a'+document.getElementById('telefon').value+'%0d%0a%0d%0a5.Факс: '+document.getElementById('fax').value+'%0d%0a%0d%0a6.E-mail: '+document.getElementById('email').value+'%0d%0a%0d%0a7.Сайт в Интернете: '+document.getElementById('site').value+'%0d%0a%0d%0a8.Ф.И.О. лица, предоставившего информацию: '+document.getElementById('fio').value+'%0d%0a%0d%0a9.Ваш контактный телефон или иной способ связи: '+document.getElementById('contact').value);
if (a.length > 2000){
alert('Ошибка.\n\rВаше письмо содержит '+a.length+' симовлов. Предельно допустимым является 2000 символов.\n\rПостарайтесь изложить информацию короче.');
document.getElementById('sendData').href='#';
} else {
//alert(a.length)
//alert(a);
document.getElementById('sendData').href=a;
}
}
</script>
<div><a id="sendData" onclick="sethref()" href="#">Отправить</a> | <a href="#" onclick="window.print()">Распечатать анкету</a></div>
Скрипт писал не Я что изменить в нем не знаю, да и не силен я в этом.
Да, в IE скрипт работает, а вот в других браузерах не хочет.
<script>
function processText(txt){
processedText = '';
for (i=0; i<txt.length; i++){
if (txt.charAt(i) == '"') processedText += '\\"';
else if (txt.charAt(i) == '\r') processedText += '%0d';
else if (txt.charAt(i) == '\n') processedText += '%0a';
else if (txt.charAt(i) == ' ') processedText += '%20';
else processedText += txt.charAt(i);
}
return processedText;
}
function sethref(){
a=processText('mailto:znaki.rk@rambler.ru?subject=Анкета: '+document.getElementById('name').value+'&body=1.Название предприятия: '+document.getElementById('name').value+'%0d%0a%0d%0a2.Сфера деятельности:%0d%0a'+document.getElementById('sfera').value+'%0d%0a%0d%0a3.Адрес:%0d%0a'+document.getElementById('adres').value+'%0d%0a%0d%0a4.Телефон:%0d%0a'+document.getElementById('telefon').value+'%0d%0a%0d%0a5.Факс: '+document.getElementById('fax').value+'%0d%0a%0d%0a6.E-mail: '+document.getElementById('email').value+'%0d%0a%0d%0a7.Сайт в Интернете: '+document.getElementById('site').value+'%0d%0a%0d%0a8.Ф.И.О. лица, предоставившего информацию: '+document.getElementById('fio').value+'%0d%0a%0d%0a9.Ваш контактный телефон или иной способ связи: '+document.getElementById('contact').value);
if (a.length > 2000){
alert('Ошибка.\n\rВаше письмо содержит '+a.length+' симовлов. Предельно допустимым является 2000 символов.\n\rПостарайтесь изложить информацию короче.');
document.getElementById('sendData').href='#';
} else {
//alert(a.length)
//alert(a);
document.getElementById('sendData').href=a;
}
}
</script>
<div><a id="sendData" onclick="sethref()" href="#">Отправить</a> | <a href="#" onclick="window.print()">Распечатать анкету</a></div>