...

View Full Version : How to call a function from a conditional



Saj
04-08-2003, 01:55 AM
Basicly, I need to say:

If this equals that, then do function test().



if(this==that) {
test();
}


Thanks

ACJavascript
04-08-2003, 01:58 AM
your right on target Saj

if(this==that){
CallFunction()
}

It works for me and all of my scripts :D

Saj
04-08-2003, 02:09 AM
Then what exactly would I do?

if(this==that){
CallFunction(test)
}

or

if(this==that){
Calltest()
}

ACJavascript
04-08-2003, 02:13 AM
you would put it like this

if(this==that){
Test()
}

----

function Test(){
alert("Hi there,, I was called by a condition.")
}

Jason
04-08-2003, 02:14 AM
it depends on if the function takes a parameter or not. if it does then there is someting in between the parenthesis otherwise there is nothing in between them.


Jason

Saj
04-08-2003, 02:18 AM
Ohh duh. The first thing you said worked for me. I was actually putting it in the wrong function at first. I'm really going crazy.

Thank though. :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum