<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Мой Блог &#187; JavaScript</title>
	<atom:link href="http://stroimsayt.com/tags/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://stroimsayt.com</link>
	<description>Тяжела и неказиста жизнь простого программиста</description>
	<lastBuildDate>Sat, 11 Jul 2009 17:18:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Ограничение на количество вводимых символов в textarea</title>
		<link>http://stroimsayt.com/2009/06/%d0%be%d0%b3%d1%80%d0%b0%d0%bd%d0%b8%d1%87%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bd%d0%b0-%d0%ba%d0%be%d0%bb%d0%b8%d1%87%d0%b5%d1%81%d1%82%d0%b2%d0%be-%d0%b2%d0%b2%d0%be%d0%b4%d0%b8%d0%bc%d1%8b%d1%85-%d1%81/</link>
		<comments>http://stroimsayt.com/2009/06/%d0%be%d0%b3%d1%80%d0%b0%d0%bd%d0%b8%d1%87%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bd%d0%b0-%d0%ba%d0%be%d0%bb%d0%b8%d1%87%d0%b5%d1%81%d1%82%d0%b2%d0%be-%d0%b2%d0%b2%d0%be%d0%b4%d0%b8%d0%bc%d1%8b%d1%85-%d1%81/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 06:35:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://stroimsayt.com/?p=110</guid>
		<description><![CDATA[Недавно пришлось сталкнуться с необходимостью ограничения на количество вводимых символов в textarea. Проект была на php, и ясное дело что при отправке формы количество символов учитывалось. А вот как быть если надо подсчитать количество до отправки ? Помог JavaScript.

function checkLen(src_id, counter_id)
{
src_val=document.getElementById(src_id).value;
counter_val=document.getElementById(counter_id).value;
counter_val=(500-(src_val.length));
if(counter_val&#38;amp;amp;amp;amp;amp;amp;lt;0)
{
src_val=src_val.substr(0, 500);
document.getElementById(src_id).value=src_val;
counter_val=0;
}

document.getElementById(counter_id).value=counter_val;

}

И то как надо оформить textarea

&#60;form&#62;
&#60;textarea name=&#34;fb_text&#34; id=&#34;fb_text&#34; cols=&#34;45&#34; rows=&#34;5&#34; onkeyup=&#34;checkLen(&#039;fb_text&#039;, &#039;fb_text_len&#039;)&#34; style=&#34;width:400px; height:140px; [...]]]></description>
		<wfw:commentRss>http://stroimsayt.com/2009/06/%d0%be%d0%b3%d1%80%d0%b0%d0%bd%d0%b8%d1%87%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bd%d0%b0-%d0%ba%d0%be%d0%bb%d0%b8%d1%87%d0%b5%d1%81%d1%82%d0%b2%d0%be-%d0%b2%d0%b2%d0%be%d0%b4%d0%b8%d0%bc%d1%8b%d1%85-%d1%81/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
