473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

sting-stored functions... plz help!

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 ...as 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
2 1116
monamac
12
i believe it is:

eval(string);

hope this helps.
Oct 9 '06 #2
monamac
12
soo....

var codeToEvaluate = "cmdinput();";
eval(codeToEvaluate);

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

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

Similar topics

1
by: DeadInPlastic | last post by:
char * blah = "blha222222blah"; i am wondering if there a way to read these 222222 at once. i can read one char at a time of course but it doesn't work for me since I have only one digit(i.e . 2)...
2
by: MP | last post by:
I have following In structure Employee is declared public int EmpId Employee mp = new Employee(); mp.EmpId = txbName.Text; Error: Cannot implicitly convert type string to int
3
by: Max Gattringer | last post by:
I have written a little programm, which converts normal Text into Unicode Bytes - nothing special, but i tried to creat 2nd Encoder which converts strings(numbers) in a textBox (strings which i...
1
by: abitpro | last post by:
I am writing a SNMP extension dll and a trigger. Now i want to send a string from trigger.exe to MyNewTrap.DLL which is loaded by SNMP.exe. When MyNewTrap.DLL has reveived this string, it's...
5
by: ad | last post by:
I have a hashtable name myHash. sKey is a string, I use myHash to retrieve the value of that key. But is sKey is not in the myHash.Keys, it raise an Exception. I want to dertiminate if sKey in...
7
by: Crumb | last post by:
Hi, I am a Newbie to SQL and am therefore sorry if this is a stupid question I am trying to run the following command SELECT OriginationNumber, DestinationNumber, StartTime, State, Duration...
1
by: tony | last post by:
Hello! I have 10 string fields which are elements or gas or someting else and some symbol behind if less then or greater then se below. In the database there is a string telling which field...
10
by: Antonio | last post by:
Hello, everyone. I have textboxes in which users enter IP Addresses. I would like to check what they entered when they press the Submit button to make sure that they entered an IP that's...
5
by: Gregory Piñero | last post by:
How do I put % in a format sting? For example I want this to work: Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: not enough arguments for format string
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.