Solved

Javascript/ html code for web page

Posted on 2012-04-12
3
224 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now