Connecting Tech Pros Worldwide Help | Site Map

Replacing Text

  #1  
Old January 25th, 2007, 06:05 PM
Jen
Guest
 
Posts: n/a
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!

  #2  
Old January 25th, 2007, 06:25 PM
Lee
Guest
 
Posts: n/a

re: Replacing Text


Jen said:
Quote:
>
>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?


--

  #3  
Old January 25th, 2007, 07:15 PM
Jen
Guest
 
Posts: n/a

re: Replacing Text




On Jan 25, 12:13 pm, Lee <REM0VElbspamt...@cox.netwrote:

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.

  #4  
Old January 25th, 2007, 07:45 PM
TheBagbournes
Guest
 
Posts: n/a

re: Replacing Text


Jen wrote:
Quote:
>
On Jan 25, 12:13 pm, Lee <REM0VElbspamt...@cox.netwrote:
>
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.
  #5  
Old January 25th, 2007, 08:15 PM
Lee
Guest
 
Posts: n/a

re: Replacing Text


Jen said:
Quote:
>
>
>
>On Jan 25, 12:13 pm, Lee <REM0VElbspamt...@cox.netwrote:
>
>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";
}


--

  #6  
Old January 25th, 2007, 08:15 PM
Evertjan.
Guest
 
Posts: n/a

re: Replacing Text


Lee wrote on 25 jan 2007 in comp.lang.javascript:
Quote:
>
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)
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Interop: Replacing text with table =?ISO-8859-1?Q?S=F8ren?= answers 1 August 27th, 2008 12:35 PM
Replacing Text without changing case?? wildman@noclient.net answers 4 March 14th, 2008 07:45 PM
Replacing text after last | delimiter baxy77bax answers 3 August 13th, 2007 02:36 PM
replacing text data in a binary file Adam J. Schaff answers 12 November 20th, 2005 08:39 PM
Replacing text with a background image affects printing Peter Foti answers 6 July 20th, 2005 09:55 PM