By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,968 Members | 1,574 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,968 IT Pros & Developers. It's quick & easy.

sting-stored functions... plz help!

P: 1
this is my first post! yay...
I am sorry if i'm very... ... ambiguous...
i have a problem that i can't seem find the direct solution to on the web, so i'm asking it here. can someone please help me with this problem? ::

i can't seem to figure a way to use a string-stored function a function...
i'm making a console 'program' out of javascript
i want a feature that allows the user to type out ANY javascript function and input it into the console so that it can run it

for example...
when i input the string "window.refresh()" or "window.close()" and store it into a variable like "cmdinput", i need a code that can read "cmdinput" and execute the string representing the function.

>my question is this: What do i do to get "cmdinput" into a string that can be executed? /or/ How do i get the browser to execute the function that is stored in a string?
i tried stuff like "javasript:cmdinput()" but i can't seem to get the string into something the browser can recognize as a command of a script...i don't know my string manipulations enough!

all replies appreciated! Thanks~
Oct 7 '06 #1
Share this Question
Share on Google+
2 Replies

P: 12
i believe it is:


hope this helps.
Oct 9 '06 #2

P: 12

var codeToEvaluate = "cmdinput();";

should execute the function.... i believe ;)
Oct 9 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.