Link to home
Create AccountLog in
Avatar of Tom Powers
Tom Powers

asked on

I need to create a if certain attrib = a string then go to canvas and write

I have this Flash code and I need to turn it into javascript it's a few simple keywords or syntax is missing cause What I want is

if $(Play).attr('PlayType') == "PERIODEND" {
		if $(Play).attr('Status') == "HT" {
			
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var grd=ctx.createLinearGradient(0,0,200,0);
grd.addColorStop(0,"Yellow");
grd.addColorStop(1,"Orange");

// Fill with gradient
ctx.fillStyle=grd;
ctx.font="30px Arial";
ctx.fillText("Hafetime",10,50);
		}
		}

Open in new window

but of course there is alot more like
END OF 1st QUARTER
END OF 2nd  QUARTER
END OF 3rd QUARTER
END OF 4th QUARTER
then if $(Play).attr('PlayType') == "PERIODSTART" This is not a problem as long as I get first
example Halftime then I can just use some code for the rest of displaying static text string based on xml data
Avatar of hielo
hielo
Flag of Wallis and Futuna image

The if syntax is wrong.  You have:
if ... {...}

You are missing the enclosing parentheses:
if (...) {...}
Avatar of Tom Powers
Tom Powers

ASKER

Yo I don't understand I have if (...) {...} Please just show me in the IF Statement I'm not brillant
if $(Play).attr('PlayType') == {"PERIODEND"}{
		if $(Play).attr('Status') == {"HT"}{
			
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var grd=ctx.createLinearGradient(0,0,200,0);
grd.addColorStop(0,"Yellow");
grd.addColorStop(1,"Orange");

// Fill with gradient
ctx.fillStyle=grd;
ctx.font="30px Arial";
ctx.fillText("Hafetime",10,50);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thanks Dude
Please read:

http://support.experts-exchange.com/customer/portal/articles/481419

>>A should be the default grade awarded unless the answer is deficient...
Sorry Heilo I wasn't paying attention. I'll get you next time. My MISTAKE i WASN'T THINKING