using eval() on a javascript function with onclick

I would like to call eval on this function and pass that as the onclick script for a button.
The reason I am doing this is a bit har to explain , so I would like to find out if it is possible at all.
essentially I would like to have this:
1) <input type="button" value="Test" onclick="eval(popupTest('testing'))" />

But this doesn't work althought the following button works:
2) <input type="button" value="Test" onclick="eval(alert('testing'))" />

So I am assuming I need some quotes inside eval() in my first button example.
But when I tried calling it with double quotes., they were not being escaped although I had the escape character:
3)<input type="button" value="Test" onclick="eval(\"popupTest('testing')\")" />
Single quotes also did nothing.

It is essential that I use eval() . Can you offer any suggestions? And why are the double quotes not being escaped when inside eval? as in example 3?

well basically i need my input button onclick to do this :
if (eval (somejavascriptfuntion)) {
click on another button
}

*previously i mentioned an regular putton but im actually using a submit.

// i have no control over the somejavascript funtion that is passed in so that is why it would be difficult to escape the parameters it has . So i amg given "popupTest('testing')" as a string

and the reason i do eval is because I need the script function (like my example popupTest) to excute wether it be a popupuWindow script or something else, then i need to click on an image button so that it can submit imageName.x imageName.y coord. to the server. This is probably more info then needed.

So there is no way to pass onclick="" the whole if(eval(function)){... do the click} thing?

Or simply said: the eval() method makes only sense for String parameter or for functions or methods which return String return values.
So I do not see why you would first make an event handler to String, pass it thent to your function as string parameter of your function, do the eval() and decide then the next step. Why not simply pass the function return value to your function as your function parameter for the next step decision?

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

I don't know if i correctly understood you but:
the reason i can not simply pass the function retun value to my function because I am implimenting a custom button tag. and the function is a String wich is set by the user.
Inside the tag implementation i need to retrieve this onclickScript the user specified, then proceed to execute it, and after that , if the onclickScript returns true( this is why i need eval) i need to click another button.

okay. but inside my customButtonTag implementation the way i write out the button is just strings..
so i would have..
"<input type='submit'" + somethingelse +
"onclick=" + //this is where iw oudl have to put my function .. "/"myFunction(" + userOnclickScript +")\""
So what happens is the userOnclickScript is a string value.. but since the whole button is written out as a string, userOnclickScript in this case is not a variable .. it would just be another string concatenated in that place.

ok thanks i will try this. So it is not possible to do: onclick='the whole function written out with the userOnclickScript'?

i guess the reason im having difficulty understanding is b/c i keep on thinking that when myFunction will be executing it would be going through the 'if(eval(........' statements anyways. So why can't i have all of that within the onclick quotes?

** i know that i am not using the whole submit button properly .. but i am doing this b/c this is a temporary hack that someone told me to do... for reasons beyond my control :)

This article discusses the difference between strict equality operator and equality operator in JavaScript.
The Need:
Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…

The viewer will learn the basics of jQuery, including how to invoke it on a web page.
Reference your jQuery libraries: (CODE)
Include your new external js/jQuery file: (CODE)
Write your first lines of code to setup your site for jQuery.: (CODE)

The viewer will learn the basics of jQuery including how to code hide show and toggles.
Reference your jQuery libraries:
(CODE)
Include your new external js/jQuery file:
(CODE)
Write your first lines of code to setup your site for jQuery…