Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


javascript help



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
Garcilazo



Joined: 06 Mar 2008
Posts: 5

PostPosted: Mon Mar 10, 2008 8:29 pm    Post subject: javascript help Reply with quote

how we use a variable within and object name?
for example if i want to get the value of an input box:
var x = document.theform.variable.value
where variable is an input field in the form

Confused thanks for the help Razz
Back to top
View user's profile Send private message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 614
Location: Cebu City Philippines

PostPosted: Tue Mar 11, 2008 2:14 am    Post subject: Re: javascript help Reply with quote

The easiest way is to name your input field.For example, you have this in your page:
Code:

<form name="myform" action="#" method="post">
<input type="text" name="myinput">
<input type="button" onclick="show()" value="Show Input Value">
</form>


If you want to get the value of the input box, it is as easy as:
Code:

function show()
{
var accept = document.myform.myinput.value
alert ('Did you key in '+accept +' right?');
}


Hope made sense Wink
Back to top
View user's profile Send private message Yahoo Messenger
Garcilazo



Joined: 06 Mar 2008
Posts: 5

PostPosted: Tue Mar 11, 2008 2:18 am    Post subject: Re: javascript help Reply with quote

we have that we are making a chess game and we have letters for the pieces and we need to figure out how to move them from one input to another input

rangana wrote:
The easiest way is to name your input field.For example, you have this in your page:
Code:

<form name="myform" action="#" method="post">
<input type="text" name="myinput">
<input type="button" onclick="show()" value="Show Input Value">
</form>


If you want to get the value of the input box, it is as easy as:
Code:

function show()
{
var accept = document.myform.myinput.value
alert ('Did you key in '+accept +' right?');
}


Hope made sense Wink
Back to top
View user's profile Send private message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 614
Location: Cebu City Philippines

PostPosted: Tue Mar 11, 2008 2:28 am    Post subject: Re: javascript help Reply with quote

No, not that easy to explain. Maybe this link would help:
http://javascript.internet.com/games/javascript-chess-with-cpu-oppo.html
http://javascript.internet.com/games/chess-player-v1.0.html Wink
Back to top
View user's profile Send private message Yahoo Messenger
Garcilazo



Joined: 06 Mar 2008
Posts: 5

PostPosted: Tue Mar 11, 2008 2:32 am    Post subject: Re: javascript help Reply with quote

thanks that should help

rangana wrote:
No, not that easy to explain. Maybe this link would help:
http://javascript.internet.com/games/javascript-chess-with-cpu-oppo.html
http://javascript.internet.com/games/chess-player-v1.0.html Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap