Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Replacing Text

Reply
Thread Tools

Replacing Text

 
 
Jen
Guest
Posts: n/a
 
      01-25-2007
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!

 
Reply With Quote
 
 
 
 
Lee
Guest
Posts: n/a
 
      01-25-2007
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?


--

 
Reply With Quote
 
 
 
 
Jen
Guest
Posts: n/a
 
      01-25-2007


On Jan 25, 12:13 pm, Lee <(E-Mail Removed)> 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.

 
Reply With Quote
 
TheBagbournes
Guest
Posts: n/a
 
      01-25-2007
Jen wrote:
>
> On Jan 25, 12:13 pm, Lee <(E-Mail Removed)> 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.
 
Reply With Quote
 
Lee
Guest
Posts: n/a
 
      01-25-2007
Jen said:
>
>
>
>On Jan 25, 12:13 pm, Lee <(E-Mail Removed)> 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";
}


--

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      01-25-2007
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
regex for replacing plain text within html string... Tim_Mac ASP .Net 2 01-21-2006 12:13 AM
Replacing HTML text before rendering OB ASP .Net 1 12-02-2005 03:36 AM
Replacing the specific pattern of text in a huge text string.. Brown Smith ASP .Net 1 06-25-2005 05:34 AM
Replacing - and not Replacing... Rob Meade ASP General 5 04-11-2005 06:49 PM
Searching and replacing multiple strings in text Chris Java 5 10-11-2003 05:12 AM



Advertisments