hey, I want to write a small snipet which will first prompt the user to input a javascript command, and then execute that command on the current page. Is there any way to do it??

say the prompt is like:

javascript: prompt();

(its working)

and the command is :

javascript: document.units.attack.click();
<input type="text" id="command">

//this assumes prototype library for low level functions like $
eval($("command").value);

You can also look at evalScripts, which is part of prototype
http://prototypejs.org/api/string/evalScripts

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.