Модераторы: Sardar, Aliance
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> русские буквы в скрипте, буржуйский скрипт русский не принимает 
:(
    Опции темы
Kokand
Дата 25.7.2003, 02:38 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 3
Регистрация: 25.7.2003

Репутация: нет
Всего: нет



My Webpage[COLOR=purple]

Здравствуйте господа программисты!
Возможно сможете подсказать как добиться от скрипта отправления формы на мыло прием русских букв. Вместослов Пушкинского языка сплошь вопросительные знаки.
Пыталася charset=windows 1251 вставлять но пока безуспешно

Коканд


PM MAIL   Вверх
Kokand
Дата 25.7.2003, 02:39 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 3
Регистрация: 25.7.2003

Репутация: нет
Всего: нет



забыл упомянуть что данный скрипт javascript
PM MAIL   Вверх
MuToGeN
Дата 25.7.2003, 09:28 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Лесник
****


Профиль
Группа: Модератор
Сообщений: 4379
Регистрация: 15.8.2002
Где: Москва

Репутация: нет
Всего: 32



Как сам скрипт выглядит?


--------------------
Three pings for the token rings,
Five pings for the UNIX machines,
Hundred pings for the broken links,
One special ping to check them all
Through Simple Network Management Protocol!
PM MAIL ICQ   Вверх
Kokand
Дата 29.7.2003, 02:07 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 3
Регистрация: 25.7.2003

Репутация: нет
Всего: нет



Старик рад, что в разноголосице есть пару движений ответить фалангами.
Я то длиннющий, древний как мир энтузиастов javascript выложу. Глянешь?
Прямо трабл какой то вдруг


Код

function makeArray(n){
     this.length = n;
     for(var i = 1; i <= n; i++){
           this[i] = 0;
     }
     return this;
  }

  var orderNum = 0;                                            
  var order = new makeArray(100);                      
  var indexNum = 0;
  var count;
  var formSave;

 function currency(money){
    money = money + ""          
    var monLen = money.length;
    var digPos = money.indexOf(".");
    if(digPos == -1 & monLen < 1){
      money = money.substring(0,digPos+ 1) + "00";
   } else if(digPos == -1 & monLen > 0){
      return money;
   }else{
             cents = money.substring(digPos + 1, monLen + 1);
             if(cents.length == 1){
                 money = money + "0";
            }else if(cents.length > 2){
                     roundVal = cents.charAt(2);
                     if(roundVal  >= 5){
                        money = parseFloat(money) + .01;
                        money = money + "";
                        money = money.substring(0,digPos + 3)
                     }else{
                         money = money.substring(0,digPos + 3)
                     }
              }
     }
    return money;
  }
     


  function showProd(form){
      var iter = 0;
      var match = false;
      var oldlen = 1;
      count = 0;
      sWin = parent.frames[2].document
      prodName = parent.frames[3].document.searcher.lookup.value;
      sWin.open();
      sWin.write("<HTML><HEAD><TITLE>"+  prodName + " </TITLE></HEAD>");
      sWin.write("<BODY  bgcolor=#ffffff  text=#000000>");
      for (var i = 1; i <= prodID.length; i++){
            //alert(theProd + " " + prodID[i].name.toUpperCase());
            if(prodName.toUpperCase() == prodID[i].name.toUpperCase()){
               indexNum = i;
               prodID[i].show(sWin,i);
               match = true;
            }
      }
      if(!match){
           pTotal = new makeArray(prodID.length);
           for (var i = 1; i <= prodID.length; i++){
                var pSearch = prodName.toUpperCase();
                var pInventory = prodID[i].name.toUpperCase();
                for(var x = 1; x <= pSearch.length; x++){
                    if(pSearch.substring(0,x) == pInventory.substring(0,x)){

                        pTotal[i] = pSearch.substring(0,x);
                    }
                 }
             }
             for (var i = 1; i <= prodID.length; i++){
                 // alert(pTotal[i] + " " + i);
                  if(pTotal[i] != "0"){
                      if(pTotal[i].length >= oldlen){
                           oldlen =  pTotal[i].length;
                           olditer = iter;
                           var iter = i;
                       }
                   }
                }
                if(oldlen  > 1){
                   sWin.write("<b>Nearest match was:</b><br> ")
                    indexNum = iter;
                   prodID[iter].show(sWin,iter);
                   if(olditer != 0){
                      sWin.write("<br><b>Next closest  match was:</b><br> ")

                       indexNum = olditer;
                      prodID[olditer].show(sWin,olditer);
                   }
                }else{
                    sWin.write("No match!");
                }
     }
          sWin.write("</BODY></HTML>");
          sWin.close();
  }

   function searchType(form){
        count = 0;
        prodTypeInfo = form;
        var match = false;
        tWin = parent.frames[2].document
        tWin.open();
       tWin.write("<HTML><HEAD><TITLE>"+  prodTypeInfo + " </TITLE></HEAD>");

       tWin.write("<BODY  bgcolor=#ffffff  text=#000000> ");
       for (var i = 1; i <= prodID.length; i++){
            if(prodTypeInfo == prodID[i].type){
               indexNum = i;
               prodID[i].show(tWin,i);
               match = true;
             }
      }
      tWin.write("</BODY></HTML>");
      tWin.close();
  }

   function product (name,description,image,price,type,link,url){
       this.name = name;
       this.description = description;
       this.image = image
       this.price = price;
       this.type = type;
       this.show = show;
       if(link != ""){
         this.link = "<center><TABLE BORDER=0><TR><TD><A HREF='" + url + "'><Font face=arial size=-2>" + link + "</font></A></TD></TR></TABLE></center>";
       }else{
         this.link = "";
       }
   }
   
   function show(w,prodIndexNum){
       w.write("</CENTER><center><TABLE BORDER = 0 WIDTH=300><TR><TD BGCOLOR=#d5d5ff><FONT FACE = 'arial' color=blue><b>"  + this.name + "</b></FONT></TD></TR></TABLE></center>");

           if(this.image.length > 1){
              w.write("<CENTER><TABLE BORDER=0 COLS=2 WIDTH=300 BGCOLOR=#FFCC00 ><TR BGCOLOR=#00CC00><TD><FONT FACE = 'Arial' SIZE = 2 >Image</FONT></TD><TD><FONT FACE = 'Arial' SIZE = 2 >Description</FONT></TD></TR><TR><TD><IMG SRC='" + this.image + "'></TD>");
w.write("<TD><FONT FACE = 'Arial' SIZE = 2 >" + this.description + "</TD></TR></Table></CENTER>");
            }
          if(this.link != ""){
             w.write(this.link);
          }


          w.write("<FORM>");
           //alert(prodIndexNum);
          orderProd(this,w,prodIndexNum);
          w.write("</FORM><HR SIZE=1 NOSHADE WIDTH=90%><br>");
         // w.write("&nbsp;&nbsp;&nbsp;&nbsp; <INPUT TYPE = 'button' VALUE = 'Go Back' onClick = history.go(-1)>");
         

   }

  function orderProd(obj,win,index){

    win.write("<CENTER><TABLE BORDER=0 COLS=2 WIDTH=300 BGCOLOR=#CCCCCC><TR><TD><FONT FACE = 'arial' size=-1><b>Price Each: $</b>" + obj.price+"</font></CENTER>");
    win.write("&nbsp;&nbsp;<FONT FACE = 'arial' size=-1><b>Enter Quantity:</b></font>  " + "<INPUT TYPE = 'text' SIZE = 3 NAME = 'q' VALUE = '1' onBlur = parent.reTotal("+ parent.count + "," +  obj.price + ") onFocus = parent.reTotal("+ parent.count + "," +  obj.price + ")><br>");

    win.write("&nbsp;&nbsp;<FONT FACE = 'arial' size=-1><b>Total:" + " $</b></font><INPUT TYPE = 'text' SIZE=7 NAME= subTotal VALUE =" + obj.price + ">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;" + "<INPUT TYPE ='button' VALUE = 'SubTotal' onClick = parent.reTotal("+ parent.count + "," +  obj.price + ")></TR></TABLE></CENTER>");

    win.write("<CENTER><IMG SRC=pickit.gif ALIGN=TEXTTOP><INPUT TYPE = 'button' VALUE = '   Put in Basket   ' onClick = parent.add(" + parent.count + "," + index + ")>")

  count++;
}




   function add(id, oIndex){
      var theForm =  parent.frames[2].document.forms[id];
       productName = prodID[oIndex].name;
       totalSum =parent.frames[2].document.forms[id].subTotal.value;
       totalQuanity =  parent.frames[2].document.forms[id].q.value;
    if(totalQuanity == 0){
        alert("You entered a quantity of 0!\n We cannot process this order");

        parent.frames[2].document.forms[id].q.value = 1;
        reTotal(id,prodID[oIndex].price);
    }else{
     if( confirm("You are adding " + totalQuanity + " order/s of " + productName + " \n Subtotal: " + totalSum + " to your shopping cart.")){

         store(oIndex,totalSum,totalQuanity);
       }else{
          alert("\n\nThis order was not placed in your shopping cart.");
       }
   }
  }

     function store(o,ts,tq){
           orderNum++;
          order[orderNum] = new cartGoods(o,ts,tq);
          showTotal = 0;
          for(var i = 1; i <= orderNum;i++){
                showTotal += parseFloat(order[i].totSum);                
           }
            parent.frames[1].document.forms[0].runningTotal.value = currency(showTotal);

    }
{   request.setCharacterEncoding("UTF-8");  } catch (java.io.UnsupportedEncodingException e) {   log.error("doSelectLanguage() : request.setCharacterEncoding() : UnsupportedEncodingException", e);  }  // SET LOCALE BASED ON LANGUAGE  java.util.Locale locale = new java.util.Locale(lang);  response.setLocale(locale);  response.setContentType("text/html; charset=UTF-8");

   function cartGoods(Indx, totSum, totQ){
        this.Indx = prodID[Indx].name;
        this.totSum = totSum;
        this.totQ = totQ;
  }

  function view(){
         vWin = parent.frames[2].document;
          vWin.open();
        vWin.write("<HTML><BODY BGCOLOR=#ffffd8  text=#000000><CENTER>");
      if(orderNum != 0){
        vWin.write("<FONT FACE='Arial' Size=5>" + "Your  Shopping Basket Contents</FONT><br><br>");

        vWin.write("<FORM><TABLE BORDER=1>");
        vWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'>Quantity</TH>");
        vWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'>Product</TH>");
        vWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'>Price</TH>");
        vWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'><FONT FACE='Arial' SIZE=2>&nbsp;</TH>");

        for(var i = 1; i <= orderNum; i++){
                  vWin.write("<TR><TD COLSPAN=1 bgcolor='#00ffff' ALIGN=CENTER>" + "<FONT FACE='Arial' SIZE=3>" + order[i].totQ + "</FONT></TD>");

                  vWin.write("<TD COLSPAN=1 bgcolor='#00ffff' ><FONT FACE='Arial' SIZE=3>" + order[i].Indx + "</FONT></TD>");

                  vWin.write("<TD COLSPAN=1 bgcolor='#00ffff' ><FONT FACE='Arial' SIZE=3>" + currency(order[i].totSum) + "</FONT></TD>");

                   vWin.write("<TD VALIGN=TOP ALIGN=CENTER  bgcolor='#00ffff' >" + "<INPUT TYPE = 'checkbox' NAME = checkbox" + i + " onclick = parent.remove(" + i + ")></FONT>");

                  vWin.write("<FONT FACE='Arial' SIZE=1><b>To remove check the" + " checkbox</b></FONT></TD></TR>");

        }
     vWin.write("</TABLE></FONT></FORM>");
     }else{
           vWin.write("<FONT SIZE = 5 FACE = 'arial'><br>" + "<br>Your shopping cart is empty!</FONT>");
           if(navigator.appName.indexOf("Netscape") != -1){
              vWin.write("<FORM><INPUT TYPE='button' VALUE='Back to Order Form' onclick='history.go(-1)'>");
           }
           }
           vWin.write("</TABLE></FONT></FORM></BODY></HTML>");
           vWin.close();
   }

   function remove(item){
      var newSum = 0;
      for(var i = item+1; i <= orderNum; i++){
         if(item == orderNum){
                  order[i].Indx = "";
                  order[i].totSum = 0;
                  order[i].totQ = "";
                  break;
         }else{
                  order[i-1].Indx = order[i].Indx;
                  order[i-1].totSum = order[i].totSum;
                  order[i-1].totQ = order[i].totQ;
         }
     }
     orderNum--;
     for(var i = 1; i <= orderNum;i++){
         newSum += parseFloat(order[i].totSum);
     }
     parent.frames[1].document.forms[0].runningTotal.value = currency(newSum);

     view();

    }
               

   function checkOut(){
       if(orderNum != 0){
       cWin = parent.frames[2].document;
       cWin.open();
       cWin.write("<HTML><BODY BGCOLOR=#ffffd8  text=#000000><CENTER>");
       cWin.write("<FONT FACE='Arial' Size=5>Your  Shopping Basket</FONT>" + "<TABLE BORDER=1><TR>");

        grandTotal = 0;
       // cWin.write("<FORM NAME = 'orderform'>");
        cWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'>Quanity</TH>");
        cWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'>Product</TH>");
        cWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'>Price</TH>");
        cWin.write("<TH COLSPAN=1 BGCOLOR='#f7efde'>Total Price</TH></TR>");
        for(var i = 1; i <= orderNum; i++){
                  cWin.write("<TR><TD COLSPAN=1 bgcolor='#00ffff' ALIGN=CENTER>" + "<Font Face = 'Arial' Size = 2>" + order[i].totQ + "</TD> ");

                   cWin.write("<TD COLSPAN=1 bgcolor='#00ffff' ALIGN=CENTER>" + "<Font Face = 'Arial' Size = 2>" + order[i].Indx + "</TD>");

                    cWin.write("<TD COLSPAN=1 bgcolor='#00ffff'' ALIGN=CENTER>" + "<Font Face = 'Arial' Size = 2>" + parent.currency(order[i].totSum/order[i].totQ)  + "</TD>" );

                    cWin.write("<TD COLSPAN=1 bgcolor='#00ffff'  ALIGN=CENTER>" + "<Font Face = 'Arial' Size = 2>" + parent.currency(order[i].totSum)  + "</TD></TR>" );

                  grandTotal += parseFloat(order[i].totSum);
        }
         finalSum = currency((grandTotal * .08) + grandTotal);
                  cWin.write("<TD COLSPAN=3 ALIGN=CENTER bgcolor='#f7efde'><b>Total:</b></TD>");

                  cWin.write("<TD COLSPAN=1 ALIGN=CENTER bgcolor='#f7efde'><b>$ " + finalSum + " </b><SMALL>(includes tax)</SMALL></TD>");

                  cWin.write("</TR></TABLE></CENTER>");
        // cWin.write("<br><br><b>Total:  $" + finalSum + " </b>(includes CA tax)<b>");

         cWin.write("</b><br><br>If this is correct please fill out and submit the form below.<br>");

     cWin.write("If there is an error in your order or something you wish" + " to change, click \"View Cart\" to make the changes.<br>");

// ATTENTION NETSCAPE USER:
// PLEASE CHANGE THE E-MAIL ON THE NEXT LINE TO YOUR OWN VALID E-MAIL!
 
         cWin.write(" <FORM NAME = orderform METHOD = POST ENCTYPE=text/plain ACTION=mailto:[email protected]>");  
         cWin.write("Email:<INPUT TYPE='text' SIZE=20 NAME='email'><br>");
         cWin.write("NAME:<INPUT TYPE = 'text' SIZE = 50 NAME = 'orderee'><br>");          

         cWin.write("Street Address: <INPUT TYPE = 'text' SIZE = 43 NAME = 'address'><br>");

         cWin.write("City: <INPUT TYPE = 'text' SIZE = 52 NAME = 'city'><br>");

         cWin.write("State:<INPUT TYPE = 'text' SIZE = 2 NAME = 'state'> &nbsp; &nbsp;");

         cWin.write("Zip Code: <INPUT TYPE = 'text' SIZE = 5 NAME = 'zip'><br><br>");

         cWin.write("Shipping Method:<SELECT NAME = 'shipSelection' onChange = 'parent.shipping(this.form," +  finalSum + ")'>");

// EDIT HERE IF YOU WANT TO CHANGE YOUR SHIPPING METHOD!

         cWin.write("<OPTION VALUE = '0'>Select Method");
         cWin.write("<OPTION VALUE = '20.95'>Same Day");
         cWin.write("<OPTION VALUE = '10.95'>Next Day");
         cWin.write("<OPTION VALUE = '7.95'>2nd Day");
         cWin.write("<OPTION VALUE = '3.95'>3 Day</SELECT><br><br>");
         cWin.write("Purchase Total = $<INPUT TYPE = 'text' SIZE = 15 NAME = 'finalTot'> includes CA tax & shipping<br>");

         cWin.write("Credit Card #: <INPUT TYPE = 'text' SIZE = 19 NAME = 'ccNum'><br>");

         cWin.write("Expiration Date: <INPUT TYPE = 'text' SIZE = 17 NAME = 'exDate'><br><br>");

         cWin.write("&nbsp;&nbsp;<INPUT TYPE = 'hidden' NAME='order'" + " VALUE = ''>");

         cWin.write("<CENTER><INPUT TYPE = 'submit' VALUE = 'Submit Order' onClick = 'parent.formData(this.form)'>");

         cWin.write("&nbsp;&nbsp;<INPUT TYPE = 'reset' VALUE = 'Reset'>");
         cWin.write("</FORM>");
         cWin.write("</b></FONT></CENTER></BODY></HTML>");
         cWin.close();
     }else{
        alert("\n\nYour shopping cart is empty!\n\n");
     }
   }

   function formData(form){

        var formElems = form.elements.length;
        formSave = new makeArray(formElems-3);
        for(var i = 1; i <= formElems; i++){
             formSave[i] = form.elements[i-1].value;
        }
        for(var i = 1; i <= orderNum; i++){
              form.elements[10].value += "Quanity:" + order[i].totQ
              form.elements[10].value += " " + order[i].Indx
              form.elements[10].value += " at " + order[i].totSum/order[i].totQ + " | "
        }
          if(navigator.appName.indexOf("Netscape") != -1){
            setTimeout(location.href="thankyou.htm",2000)
            form.submit();
           }else{
             alert("Submitting of form with mailto tag is only possible in Netscape Navigator!")
             return false;
            }
   }
             

     function reTotal(c,totalPrice){
            totalPrice = totalPrice * parent.frames[2].document.forms[c].q.value;

            newTotal = currency(totalPrice)
            parent.frames[2].document.forms[c].subTotal.value = newTotal;
     }

    function shipping(form, fSum){
         shipCost = form.shipSelection.options[form.shipSelection.selectedIndex].value;

         form.finalTot.value =currency( parseFloat(shipCost) + parseFloat(fSum));

   }

   function empty(){
      if(orderNum == 0){
         alert("\n\nYour cart is already empty!\n\n");
      }else{
          orderNum = 0;
          alert("\nYour cart has been emptied!\n");
      }
  }



хороший писатель Даниил Хармс
PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Форум для вопросов, которые имеются в справочниках, но их поиск вызвал затруднения, или для разработчика требуется совет или просьба отыскать ошибку. Напоминаем: 1) чётко формулируйте вопрос, 2) приведите пример того, что уже сделано, 3) укажите явно, нужен работающий пример или подсказка о том, где найти информацию.
 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | JavaScript: Общие вопросы | Следующая тема »


 




[ Время генерации скрипта: 0.0449 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.