Jump to content

variable in if else


dowp213
 Share

Recommended Posts

how to assign a string to a variable in a if..else?for example:if (condition){(var output="dog")}so that the variable "output" would be displayed after....
like DD hinted, this post seems like kind of a half thought... but I think the second post get's to what you were looking for.. I think. Have you read through the Javascript tutorials?http://www.w3schools.com/js/default.asp
Link to comment
Share on other sites

how to assign a string to a variable in a if..else?for example:if (condition){(var output="dog")}so that the variable "output" would be displayed after....
Depending on where you are going to display it, you may want to create the variable outside of the if:
var output;if (condition == true){	output = "dog";}

As for displaying it, that depends on how/where you want it to display. Looking at the tutorial would be a good idea. If you already have and still don't know how to do it, please explain more of what you're going for. We'll be happy to point you in the right direction, but I doubt anyone will actually give you the full code.

Link to comment
Share on other sites

the problem is not with the if..else.. but rather the whole structure of my codes.. but the reply helps really well..the reply really concluded something..I'm new at this,glad that there's always a forum and it's members to help..the admin can close this thread now..

Link to comment
Share on other sites

oh. so what did you really mean to post about? It might be more practical to post a question about the whole problem, so you can get better, more relevant help. If you have an example of your code and what you're trying to do...

Link to comment
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
 Share

×
×
  • Create New...