Closed Thread Icon

Topic awaiting preservation: input.length>5??? Pages that link to <a href="https://ozoneasylum.com/backlink?for=8652" title="Pages that link to Topic awaiting preservation: input.length&amp;gt;5???" rel="nofollow" >Topic awaiting preservation: input.length&gt;5???\

 
Author Thread
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 05-15-2003 04:09

Hi, guys. I am doing tutorial from www.w3schools.com .
What I am doing is that if user input more than 5 characters, alert box pops up. If not, it will be submiteted.
Please see this:

code:
<html>
<head>

<script type="text/javascript">
function validate()
{
x=document.myForm
input=x.myInput.value
if (input.length>5)
{
alert("Do not insert more than 5 characters")
return false
}
else
{
return true
}
}
</script>
</head>

<body>
<form name="myForm" action="tryjs_submitpage.htm" onsubmit="return validate()">

In this input box you are not allowed to insert more than 5 characters:
<input type="text" name="myInput">

<input type="submit" value="Send input">

</form>
</body>
</html>



I don't understand why input.length>5??? I feel like it would be suppoed to be like input.length<5. But the code above works fine. I just wanted to know if there were good way to understand why.

Many thanks.

Hiroki Kozai

Rinswind 2th
Maniac (V) Inmate

From: Den Haag: The Royal Residence
Insane since: Jul 2000

posted posted 05-15-2003 08:02

Remember math class?

'=' means 'equal to'
'<' means 'smaller as' eg 4<5 or '100/1000 <1%'
'>' means 'bigger as'

It's realy simple take a closer look at the symbols. There is a small part and there is the bigger part. The small part is pointing to the smaller number.

Your scritpt says:
if input.length is biggger as 5 do stuff (give alert)
else go on


__________________________________________
"Art has to be forgotten. Beauty must be realized."
Piet Mondriaan

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 05-15-2003 15:32

Being natively english speaking myself and born in England then the > symbol would better be described as 'Bigger Than...' rather than 'Bigger As...'

I.E. if ( input.length 'Is Bigger Than' 5 ) { do this }

I don't mean to criticise Rinswind 2th's use of language, I'm assuming he probably speaks more than one language which is far better than me. I just thought it'd make better sense to some people reading this to replace the 'as' with a 'than'.

Rinswind 2th
Maniac (V) Inmate

From: Den Haag: The Royal Residence
Insane since: Jul 2000

posted posted 05-15-2003 21:40

thanks smonkey... i'm not native english. Thought about 'than' but it seemed to obvious since the symbol means "groter dan" in dutch.

__________________________________________
"Art has to be forgotten. Beauty must be realized."
Piet Mondriaan

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 05-16-2003 00:58

Hi, guys. Good morning.
Many many thanks for your replies.
I am not native English speaker neither.
English often be more difficult than anything except making beautiful girl friend.
Thanks.


Hiroki Kozai

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 05-16-2003 01:45

Ok since I am the native english speaker here I will help you out with your use of language:

Hiroki: "I am not native english speaker neither." - 'not' and 'neither' are both negatives, therefore as we all kno from javascript math (and realworld math), that two negatives together make a positive, this is true in the english language too, so you have actually said "I am a native english speaker also". The correct phrase would be - "I am not a native english speaker either."

Hiroki: "English often be more difficult than anything except making beautiful girl friend" - 'making beautiful girlfriend'? You havn't been buying those online sex toy diy kits have you? trust me, you run a serious risk of electrocution during *erm* usage.

LOL - sorry guys, I'm just joking with you, most guys in England speak crap anyway, so you are doing much better than them and you are perfectly and easily understandable which is the whole point of communication at the end of the day.

I hope all the foreign peeps keep on learning english, without you/them learning it english speakers and the rest of the world would never communicate - most native english speakers can't be bothered to learn other languages, so I'm happy so many other language speaking people make the effort.

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 05-16-2003 01:52

ich habe ein pony

was ist das

winkelmesser

ich bin ein scheitzer

Rinswand: make any sense to you? it is just some of the fragments of german (not the same as dutch I know, but quite close isn't it?) I can remember from my school days, I not sure if I've got the above lot exactly correct, so you can correct me now if you like.

Hiroki: not sure what your native language is so I wont try, are you a native new zealander?

Be good my esteemed foreign friends,

Jon


[This message has been edited by smonkey (edited 05-16-2003).]

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 05-16-2003 04:51

Hi, Smonkey.
Thanks a lot for your lesson.
Hmm.....My English is far behind how I'd like to achieve....
Hmm....

Hiroki Kozai

Rinswind 2th
Maniac (V) Inmate

From: Den Haag: The Royal Residence
Insane since: Jul 2000

posted posted 05-16-2003 18:08

Smonkey my german is not that good i can recognize it as german. And that is about it...
You are right when saying German and Dutch are related but this relation lays in the very past.
They both are germanic languages but both evolved, since the time we had the same language, very much.
Today dutch is related to flamish (the belgian-dutch) and afrikaans (the language from the white people in South-Africa), even in Surinam they speak some kind off dutch. But when confronted with afrikaners or surinamers i would have a real hard time to understand them.
The differences with German (Deutsch as they call it) are even bigger.

But for the record i will try some translations:

ich habe ein pony >---------> I have a pony >---------> Ik heb een pony

was ist das >--------> What is that? >----------> Wat is dat?

winkelmesser >---------> Angle gauge >--------> Hoekmeter

ich bin ein scheitzer ???? Schweizer? >--------> I am a swiss >---------> Ik ben zwitsers.



__________________________________________
"Art has to be forgotten. Beauty must be realized."
Piet Mondriaan

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 05-16-2003 21:43

Ok well your translations were pretty much what I thought I'd said so that's good.

My family on my fathers side (my grandad and his family) all come from South Africa, so I know a bit about the white Dutch people there, I also have a few South African friends. Thanks for the rest of the lesson tho, it was interesting and insightful.

« BackwardsOnwards »

Show Forum Drop Down Menu