HI, i need a greasemonkey code for a web page. The page has hidden input type and value. I need a gm script which can alert the value of the hidden input object as soon as the page loads.
The input tag is present in a form with:
form id="bloog" method="post" action= "/newpage.php" name="bloog">
The hidden content is present as:
<input type="hidden" value="abcd" name="ans">
now as soon as the page loads the value abcd must come in the alertbox.. some body please help m开发者_C百科e i've been trying for these...
Something like this might work.
// ==UserScript==
// @name Script Name Here
// @namespace http://www.yourdomain.com
// @description An Greasemonkey script that hides alerts hidden field value
// @include *
// ==/UserScript==
var inputs = document.getElementsByTagName('input');
for (i=0; i<inputs.length; i++) {
if (inputs[i].getAttribute("name") == "ans") {
alert(inputs[i].getAttribute("value"));
}
}
Read Get Started With Greasemonkey on WebMonkey
精彩评论