Solved

Javascript/ html code for web page

Posted on 2012-04-12
3
228 Views
Last Modified: 2012-04-13
I have a web page and I want it to display different text based on a tokenS that are rendered into text on the webpage when loaded.

The tokens are C2B_NRPLANCODE and C2B_NRINSTDESC

here is what I'm looking for:

If C2B_NRPLANCODE startswith “XX”  and C2B_NRINSTDESC = "Trumpet" then
“text”

Else if C2B_NRPLANCODE starts with “YY”  and C2B_NRINSTDESC = "Trombone" then
                “text”

Else
                “text”

Can I do this?  and can I get an examle of the code?

Thanks,
MS
0
Comment
Question by:mschirad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Accepted Solution

by:
nishant joshi earned 450 total points
ID: 37839195
<script type="text/javascript">
var red = 1;
var result = null;
if (red == 1) {
result = 'one';
} else if (red == 2) {
result = 'two';
} else {
result = 'unknown';
}
document.write(result);
</script>

Open in new window

0
 

Author Comment

by:mschirad
ID: 37839234
yes!  

is there a way for your var to use "startswith" ?

thank you!
0
 
LVL 18

Assisted Solution

by:nap0leon
nap0leon earned 50 total points
ID: 37843432
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question