How to create your own color name
Given the following statement:
$('#upLatImb').append('<span style="color:#F62817; text-decoration:blink">' + sprintf("%11.0f",fCargoLatMom).replace(/ /g,' ') + '</span'); I would like to do something like:
var problemcolor=0xF62817; $('#upLatImb').append('<span style="color:problemcolor; text-decoration:blink">' + sprintf("%11.0f",fCargoLatMom).replace(/ /g,' ') + '</span'); but this leads to numerous html errors.
I could, of course, search and replace all .js files to change the color, but I would like to use logical names, if possible, and change only one statement for each color.
I am only slightly above the absolute beginner level, so all suggestions are welcome.
Looks like you want something memorable for reuse?
Create a CSS class with the property "color: # F62817" and apply the class instead of inline styles, which are usually not preferred.
So your CSS:
.problemcolor { color: #F62817; } .blink { text-decoration: blink; } And your jQuery:
$('#upLatImb').append('<span class="problemcolor blink">' + sprintf("%11.0f",fCargoLatMom).replace(/ /g,' ') + '</span'); There is no concatenation! This leads to cleaner HTML / CSS and is better suited and remembered immediately.