By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,635 Members | 2,188 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,635 IT Pros & Developers. It's quick & easy.

Changing a variable value??

P: 2
Hi...
In a website html code there is variable value e.g. x=100 which appears on website.....For just my personalizing is there any way by which i can change the value of x e.g. x=10 using greasemonkey script....

e.g.
Expand|Select|Wrap|Line Numbers
  1. var x = 100;
  2. var y = 0;
  3. function startClock() {
  4.     if (x !== 'Done') {
  5.         x = x-y;
  6.         setTimeout("startClock()", 1000);
  7.     }
  8.     if (x == 0) {
  9.         x = 'Done';
  10.         z='success';
  11.     }
  12. startclock()
Jan 13 '08 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

Changing x depends on where x is defined and used. It may be too late by the time the Greasemonkey script runs.

Is the startclock() function your code or the code that you want to affect?
Jan 14 '08 #2

P: 2
Welcome to TSDN!

Changing x depends on where x is defined and used. It may be too late by the time the Greasemonkey script runs.

Is the startclock() function your code or the code that you want to affect?
the code is from server side but they assign value to 'x' only once in the starting....
so if grease monkey can once change it ....it will work for me
thank you!!!!
Jan 14 '08 #3

acoder
Expert Mod 15k+
P: 16,027
the code is from server side but they assign value to 'x' only once in the starting....
so if grease monkey can once change it ....it will work for me
thank you!!!!
Give it a try by changing the value of x in Greasemonkey (a simple 'x = 10') and see if it works.
Jan 15 '08 #4

Post your reply

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