|
|
|
|
|
для: Crux
(03.07.2008 в 07:46)
| | ах епт, а я и забыл про такой нюанс... | |
|
|
|
|
|
|
|
для: Crux
(03.07.2008 в 07:46)
| | СПАСИБО всем огромное. Очень помогли! | |
|
|
|
|
|
|
|
для: Port_Artur1
(02.07.2008 в 21:02)
| |
txt = txt.replace(new RegExp(str1.charAt(i),"g"), str2.charAt(i));
|
| |
|
|
|
|
|
|
|
для: Port_Artur1
(02.07.2008 в 20:24)
| | Через getElementById в IE тоже не работает!?
Ну что не так?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>1234567</title>
<script type="text/javascript">
function keypress()
{
var txt=document.getElementById('asd').value;
str1 = "12345";
str2 = "abcde";
for(i=0; i<str1.length; i++)
{
txt = txt.replace(new RegExp(str1[i],"g"), str2[i]);
}
document.getElementById('sdf').value=txt;
}
</script>
</head>
<body>
<form name="www">
<input id="asd" name="n1" type="text" onKeyUp="keypress()" maxlength="20" size="20">
<input id="sdf" name="n2" type="text" maxlength="20" readonly size="20">
</form>
</body>
</html>
|
| |
|
|
|
|
|
|
|
для: Port_Artur1
(02.07.2008 в 14:48)
| | HELP | |
|
|
|
|
|
|
|
для: Port_Artur1
(02.07.2008 в 13:54)
| | Работает только в Opera
В IE не работает. Почему? Помогите!
Если кому не трудно, пожалуйста, проверьте в других браузерах.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>1234567</title>
<script type="text/javascript">
function keypress(text)
{
str1 = "12345";
str2 = "abcde";
for(i=0; i<str1.length; i++)
{
text = text.replace(new RegExp(str1[i],"g"), str2[i]);
}
document.forms['www'].n2.value= text;
}
</script>
</head>
<body>
<form name="www">
<input name="n1" type="text" onKeyUp="keypress(this.value)" maxlength="20" size="20">
<input name="n2" type="text" maxlength="20" readonly size="20">
</form>
</body>
</html>
|
| |
|
|
|
|
|
|
|
для: Port_Artur1
(02.07.2008 в 11:15)
| | в IE не работает | |
|
|
|
|
|
|
|
для: Port_Artur1
(02.07.2008 в 11:12)
| | Но так
text = text.replace(new RegExp(str1[i],"g"), str2[i]);
|
конечно лучше | |
|
|
|
|
|
|
|
для: bronenos
(02.07.2008 в 10:33)
| | Спасибо большое за помощь,
но пока также искал и сам вот что нарыл
Работает точно также
for(i=0; i<str1.length; i++)
{ while (text.indexOf(str1[i])>=0)
text = text.replace(new RegExp(str1[i]), str2[i]);
}
|
только не понял что делает while (text.indexOf(str1[i])>=0) | |
|
|
|
|
|
|
|
для: Port_Artur1
(02.07.2008 в 09:47)
| | | |
|
|
|
|