Javascript Anywhere!

By Moishy Last update Mar 13, 2009 — Installed 878 times.

Usefullness of this script

in
Subscribe to Usefullness of this script 11 posts, 4 voices



Moishy Script's Author

Once in a while I come across a page that I need to change a minor thing to bypass something or whatever.
So I type in the the address bar: javascript:document.getElementById('whatever').value="new_value";

But this most of the time does not work as for the browser will open a NEW page now! I wanted the script to run on the currently OPEN page.
But this is not do-able!
So at last... This script will run javascript on the running page!

Just press F12, then type the JS and hit OK!
And your done!

 
qrafzv User

Thank you, moishy!
Your script is indeed very useful.
I would like to suggest that you make some API or functions so that people can just run the pre-programmed function.

For example make the function:
function color(color){document.bgColor=color;}

Now the user will only have to type in: color('red')

Please let me know if you like my idea

 
Moishy Script's Author

Hi!
I read your idea, and I really liked it.
I'm adding your function to the script right now...

 
right passed u User

hey great cept im on a mac and f12 opens dashboard...can u make it like f10

 
Moishy Script's Author

I've updated the script so that mac users should use F10.
I don't own a mac, so I can't test that it works.
Please let me know if it works

 
right passed u User

thanks ill let u know

 
right passed u User

works perfect thx

 
right passed u User

so lets way i wanted it to click a button that said 1 on it i wood type in 1button.click(); right?

 
Moishy Script's Author

No.
As far as I know, that wouldn't work.
What I thought you'll have to do is, to find out the id of that button.
Let's say it is "but1".
Then you'll type document.getElementById("but1").click()
When it is the last statement of the code, you don't have to make a semi-colon (;)

Method #2 would be to type document.getElementsByTagName("button")[0].click()
that would click the first button on the page.
If you want to click the second button on the page, change [0] to [1] and so on.
If it is a submitting button then you would need a more complex line of script
Let me know if it worked for you.

 
right passed u User

thx

 
sizzlemctwizzle Scriptwright

Moishy wrote:
Once in a while I come across a page that I need to change a minor thing to bypass something or whatever.
So I type in the the address bar: javascript:document.getElementById('whatever').value="new_value";
But this most of the time does not work as for the browser will open a NEW page now!
javascript:void(document.getElementById('whatever').value="new_value");

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel