Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help with the script

    i have this

    Code:
    VERSION BUILD=6650406 RECORDER=FX
    TAB T=1
    URL GOTO=something.com
    TAG POS=2 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=NAME:id CONTENT=something1
    SET !ENCRYPTION NO
    TAG POS=2 TYPE=INPUT:PASSWORD FORM=NAME:NoFormName ATTR=NAME:pw CONTENT=something1
    SET !ENCRYPTION NO
    TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:NoFormName ATTR=NAME:pw2 CONTENT=something1
    TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=NAME:email CONTENT=something@so.com.com
    TAG POS=1 TYPE=SELECT FORM=NAME:NoFormName ATTR=NAME:year CONTENT=%1964
    TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:NoFormName ATTR=VALUE:Register!

    now what i need is to change the code so the "something" in all CONTENT will change everytime. the math formula would be
    [x]+1 where x = something

    so it would end up as something1 ->something2->something3 and so on and on and on

    any ideas how can i change it?

    sorry - total javascript newbie over this side of screen

  • #2
    New Coder
    Join Date
    Feb 2010
    Posts
    44
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I have no idea what all that is inside your <code></code> area. It sorta looks like something similar to ASP or something... I can't guess. So I'm gonna assume it's just a String literal.

    If it is a String literal and you want to change values of "something" to one thing and "something1" to another thing, and so on, then all you need is regular expressions and the String's replace() method.

    int x = 0;
    var myString = "x + 1 = y";
    myString = myString.replace("x", x);//replace first occurrence of x
    myString = myString.replace(/x/g,x);//replace ALL occurrences of x


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •