Replacing Text

Discussion in 'Javascript' started by Jen, Jan 25, 2007.

  1. Jen

    Jen Guest

    Is it possible to do something like this with JavaScript?

    If doc.Folder = "Select Doc Type"
    Change doc.Folder to = "Journal Invoice"

    I have been playing around with this, and just can't seem to get the
    right syntax.

    Thanks!
     
    Jen, Jan 25, 2007
    #1
    1. Advertising

  2. Jen

    Lee Guest

    Jen said:
    >
    >Is it possible to do something like this with JavaScript?
    >
    >If doc.Folder = "Select Doc Type"
    >Change doc.Folder to = "Journal Invoice"
    >
    >I have been playing around with this, and just can't seem to get the
    >right syntax.


    What have you tried?


    --
     
    Lee, Jan 25, 2007
    #2
    1. Advertising

  3. Jen

    Jen Guest

    On Jan 25, 12:13 pm, Lee <> wrote:

    What have you tried?

    I have tried:
    If doc.Folder = "Select Doc Type"
    then doc.Folder = "AR Invoice";

    var rename = doc.Folder

    If rename = "Select Doc Type"
    doc.Folder = "AR Invoice";

    I am really not good at writing code, so I am sure that these aren't
    even close to being correct.
     
    Jen, Jan 25, 2007
    #3
  4. Jen wrote:
    >
    > On Jan 25, 12:13 pm, Lee <> wrote:
    >
    > What have you tried?
    >
    > I have tried:
    > If doc.Folder = "Select Doc Type"
    > then doc.Folder = "AR Invoice";
    >
    > var rename = doc.Folder
    >
    > If rename = "Select Doc Type"
    > doc.Folder = "AR Invoice";
    >
    > I am really not good at writing code, so I am sure that these aren't
    > even close to being correct.


    Have you considered learning Javascript? It would help a lot.
     
    TheBagbournes, Jan 25, 2007
    #4
  5. Jen

    Lee Guest

    Jen said:
    >
    >
    >
    >On Jan 25, 12:13 pm, Lee <> wrote:
    >
    >What have you tried?
    >
    >I have tried:
    >If doc.Folder = "Select Doc Type"
    > then doc.Folder = "AR Invoice";
    >
    >var rename = doc.Folder
    >
    >If rename = "Select Doc Type"
    >doc.Folder = "AR Invoice";
    >
    >I am really not good at writing code, so I am sure that these aren't
    >even close to being correct.


    I wouldn't say you're not good at writing code.
    What you're really bad at seems to be research.

    The Javascript "if..else" syntax is described here:
    http://docs.sun.com/source/816-6408-10/stmt.htm#1004833

    The comparison operators are here:
    http://docs.sun.com/source/816-6408-10/ops.htm#1060974


    if ( doc.Folder == "Select Doc Type" ) {
    doc.Folder = "AR Invoice";
    }


    --
     
    Lee, Jan 25, 2007
    #5
  6. Jen

    Evertjan. Guest

    Lee wrote on 25 jan 2007 in comp.lang.javascript:

    >
    > if ( doc.Folder == "Select Doc Type" ) {
    > doc.Folder = "AR Invoice";
    >}
    >


    Or:

    doc.Folder =
    doc.Folder.replace(/^Select Doc Type$/,'AR Invoice';





    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jan 25, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brown Smith
    Replies:
    1
    Views:
    504
    Frankie
    Jun 25, 2005
  2. OB
    Replies:
    1
    Views:
    401
    Steve C. Orr [MVP, MCSD]
    Dec 2, 2005
  3. Tim_Mac
    Replies:
    2
    Views:
    605
    Tim_Mac
    Jan 21, 2006
  4. Chris
    Replies:
    5
    Views:
    8,057
    Christopher R. Barry
    Oct 11, 2003
  5. Rob Meade

    Replacing - and not Replacing...

    Rob Meade, Apr 5, 2005, in forum: ASP General
    Replies:
    5
    Views:
    282
    Chris Hohmann
    Apr 11, 2005
Loading...

Share This Page