Counter Script

E

Evertjan.

Lee wrote on 03 okt 2005 in comp.lang.javascript:
Evertjan. said:

I'm sorry this seems to difficult for you to understand,
but it's the accusation of "hiding behind" other who share
my opinions that is offensive. You might recall that in the
original message, I also mentioned that others share your
opinion.

You are welcome to feel sorry, but that is not necessary, I am not
offended by people that have different views over culturals
offensiveness.

This is an international NG, so local feelings can not always be
considered.
Do you suppose that might be why I suggested that our disagreement
might be due to cultural differences? A culture in which it is
not considered impolite to accuse people of "hiding behind" others
who share their opinions seems very strange to me.

I think that is your personal problem, but reacting an international NG
the way you did is not. By using words that are clearly ment(!) to be
offensive ["asshole"] clearly marks your reaction in a different level.

I am sure I never wanted to offend you. About the opposite, however I am
not so sure.
 
W

wolfing1

Lee said:
Papajo said:

<form>
<input type="text" name="amount" size="4" value="0">
<input type="button" value="up"
onClick="this.form.amount.value++;">
<input type="button" value="down"
onClick="if(this.form.amount.value>'0')this.form.amount.value--;">
</form>
Hi all. Came upon this thread by chance. Very informative (if we
ignore the fighting). I have a simple stupid question. Why do you
enclose 0 in quotes? like "if(this.form.amount.value>'0')". Why not
just ">0"? wouldn't it mess things if like, for example, for some
reason, the field was '00' (which is >'0' I think)?
 
E

Evertjan.

wrote on 03 okt 2005 in comp.lang.javascript:
Hi all. Came upon this thread by chance. Very informative (if we
ignore the fighting). I have a simple stupid question. Why do you
enclose 0 in quotes? like "if(this.form.amount.value>'0')". Why not
just ">0"? wouldn't it mess things if like, for example, for some
reason, the field was '00' (which is >'0' I think)?

The quoting has no purpose, since < and > should convert to numbers
anyway.

Comparing the strings '3'>'0' gives true,
because it compares the ascii 51>48

The safest is always converting the DOM value
[which always is a string], to a number:

onClick="if( +this.form.amount.value > 0) .........

==============

testing:

alert('00'>'0') //true
alert(00 > 0) //false !!!

alert('60'>'00') //true
alert(60 > 00) //true
alert(' 60'>'0') //false !!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top