/    Sign up×
Community /Pin to ProfileBookmark

my counter won’t count on Fx

hello

this is my counter

[code]
var agt=navigator.userAgent.toLowerCase();
function sz(t) {
a = t.value.split(‘n’);

b=1;
for (x=0;x < a.length; x++) {
if (a[x].length >= t.cols) b+= Math.floor(a[x].length/t.cols);
}
b+= a.length;
//if (b > t.rows && agt.indexOf(‘opera’) == -1)
if(b<5)
t.rows = b;

}

// now i make counting for total chars and total number of msgs according to the language of msg 1=unicoded 0=normal
function unicode(strText)

{

str = “”;

for (i=0; i<strText.length; i++)

if (str.indexOf(strText.charAt(i)) != -1)

return 1;

return 0;

}

unction charPlus()
{
strLen = SMSForm.message.value.length;
SMSForm.numChars.value = strLen;
if (unicode(SMSForm.message.value))
{
SMSForm.unicode1.value = 1;
numChar=SMSForm.message.value.length;
counterI=0;
if(numChar>70)
while(numChar>0)
{
numChar -=67;
counterI++;
}
else
counterI++;
SMSForm.numMsgs.value = counterI;
}
else
{
SMSForm.unicode1.value = 0;
numChar=SMSForm.message.value.length;
counterI=0;
if(numChar>160)
while(numChar>0)
{
numChar -=134;
counterI++;
}
else
counterI++;

SMSForm.numMsgs.value = counterI;
}

}
[/code]

works fine with ie , opera , everything but Firefox

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERDec 10.2007 — What kind of errors are being reported in the FF error console?

What are you trying to accomplish with your code?
Copy linkTweet thisAlerts:
@ChicooauthorDec 10.2007 — basicaly it should count total letters in sms messages and total messages according to msg language

if unicode 1msg = 70char and each 34 counts new msg

else = 160 char and each 134 counts new msg
Copy linkTweet thisAlerts:
@ChicooauthorDec 10.2007 — <TEXTAREA id="message" name="message" wrap="virtual" rows="6" cols="47" class="loogg" onkeydown=sz(this);charPlus() onkeyup=sz(this);charPlus() ><?

$message = $_POST["message"];

if($message){ echo $message ; }

?></textarea>
×

Success!

Help @Chicoo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...