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 $

You can also look at evalScripts, which is part of prototype

Be a part of the DaniWeb community

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