Jump to content
xisto Community
iGuest

Fun With Javascript And Forms Lets have some fun with javascript

Recommended Posts

I will post here every week with new and exciting things to do in javascript!

After i finish 10 of them , ill do Ajax(real-time)

-

1.Alerting and documenting Forms

Ever seen those dynamic sites where if you hove your mouse or type something bad..etc , it popups up or dynamically gets written onto the page? Well i am here to teach or rather help with all that stuff!

 

Step 1:Get notepad out and make a form

 

<form name='test'><input type='text' name='field1'>Text displays here:<div id='r'></div>

Step 2:

Add the javascript Bit

 

<script type="text/javascript">function onKeyDown() {document.GetElementById('r').innerHTML=document.test.field1.value;}</script>

Step 3 :CONCLUSION

We join both of them

 

<script type="text/javascript">function onKeyDown() {document.GetElementById('r').innerHTML=document.test.field1.value;}</script><form name='test'><input type='text' onKeyDown='onKeyDown()' name='field1'>Text displays here:<div id='r'></div>

Result:

Suppose you type Xisto, letter by letter, tehn in that div area, it will come letter by letter too.

A

A

As

As

Ast

Ast

like that

 

Hope this helped!

Will get a good one next time~

Share this post


Link to post
Share on other sites

I will post here every week with new and exciting things to do in javascript!

After i finish 10 of them , ill do Ajax(real-time)

-

1.Alerting and documenting Forms

Ever seen those dynamic sites where if you hove your mouse or type something bad..etc , it popups up or dynamically gets written onto the page? Well i am here to teach or rather help with all that stuff!

 

Step 1:Get notepad out and make a form

 

<form name='test'><input type='text' name='field1'>Text displays here:<div id='r'></div>

Step 2:

Add the javascript Bit

 

<script type="text/javascript">function onKeyDown() {document.GetElementById('r').innerHTML=document.test.field1.value;}</script>

Step 3 :CONCLUSION

We join both of them

 

<script type="text/javascript">function onKeyDown() {document.GetElementById('r').innerHTML=document.test.field1.value;}</script><form name='test'><input type='text' onKeyDown='onKeyDown()' name='field1'>Text displays here:<div id='r'></div>
Result:

Suppose you type Xisto, letter by letter, tehn in that div area, it will come letter by letter too.

A

A

As

As

Ast

Ast

like that

 

Hope this helped!

Will get a good one next time~

Thanks, i think that i would use it in my last project.

 

BTW, i hope that you post soon all the other stuff not in 9 weeks :rolleyes:

 

Best regards,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.