Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [js]textareay
kubatron
post
Post #1





Grupa: Zarejestrowani
Postów: 581
Pomógł: 0
Dołączył: 21.07.2003
Skąd: Jasło

Ostrzeżenie: (0%)
-----


Witam pisze skrypt newsów i mam takie pytanie czy da sie zrobic 2 text areay i jak pisze w jednej to w drugiej pisze sie to samo i w pierwszej jest ograniczenie do np. 240znaków po wykorzystaniu sie 240 znakow przenosi mnie do drugiej i pisze w drugiej :wink:

Z góry byłbym wdzieczny
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Teodor
post
Post #2





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 13.04.2003
Skąd: Poznan

Ostrzeżenie: (0%)
-----


Witam
to dziala w Mozilli i powinno tez w IE:
Przyklad: http://son.quake2.org/test/textar.html
[xml:1:c4ba67b80a]<?xml version="1.0" encoding="iso-8859-2"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<script type="text/javascript">
//<![CDATA[
maxchars = 50;
function LoadVar() {
s1 = document.getElementById('charsleft');
s1.innerHTML = maxchars;
}
function Popraw1() {
t1 = document.getElementById('textar1');
t2 = document.getElementById('textar2');
s1 = document.getElementById('charsleft');
if (t1.value.length < maxchars) {
t2.value = t1.value;
}
else{
t2.value = t1.value;
t2.disabled = false;
t1.disabled = true;
t2.focus();
}
s1.innerHTML = maxchars - t1.value.length;
}
function Popraw2() {
t1 = document.getElementById('textar1');
t2 = document.getElementById('textar2');
s1 = document.getElementById('charsleft');
if (t2.value.length < maxchars) {
t1.value = t2.value;
t1.disabled = false;
t2.disabled = true;
t1.focus();
}
s1.innerHTML = maxchars - t1.value.length;
}
//]]>
</script>
</head>

<body onload="LoadVar()">
<p>Zostało <span id="charsleft"></span> znaków.</p>
<div>
<textarea onkeyup="Popraw1()" onchange="Popraw1()" rows="5" cols="50" id="textar1"></textarea>
<textarea onkeyup="Popraw2()" disabled="disabled" rows="5" cols="50" id="textar2"></textarea>
</div>
</body>
</html>[/xml:1:c4ba67b80a]

Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 09:20