PDA

View Full Version : A very Basic Javascript Question



javalove
Feb 3rd, 2011, 09:55 AM
Hello All

Its my first post on this forum.

I have a database setup with tables that use my form element names as column names.

Now i have successfully retrieved column names and values from the server side to the client side. .

I have the column name stored in

var columnName

How can I get the type of form element type and how can i set the value to it

Thanks for your help



#Javalove. . .unless otherwise stated. . .!

StrangeCoder
Feb 3rd, 2011, 10:04 AM
You can't connect JavaScript with MySQL like that.
You need a connector, known as AJAX, anyway this is the best method.

Here is an example:
http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_database

gusblake
Feb 3rd, 2011, 10:05 AM
document.getElementsByName(columnName)[0].type

javalove
Feb 3rd, 2011, 10:10 AM
document.getElementsByName(columnName)[0].type


Brilliant!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Worked like magic. . .thanks alot bro. . .


#Javalove. . .unless otherwise stated. . .!