Changing a variable value??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yadavvikku
    New Member
    • Jan 2008
    • 2

    Changing a variable value??

    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.
    [CODE=javascript]var x = 100;
    var y = 0;
    function startClock() {
    if (x !== 'Done') {
    x = x-y;
    setTimeout("sta rtClock()", 1000);
    }
    if (x == 0) {
    x = 'Done';
    z='success';
    }
    startclock()[/CODE]
    Last edited by gits; Jan 13 '08, 09:09 PM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #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?

    Comment

    • yadavvikku
      New Member
      • Jan 2008
      • 2

      #3
      Originally posted by acoder
      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!!!!

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by yadavvikku
        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.

        Comment

        Working...