Friday 15 February 2013

javascript - Coding issue with drawing a line -


I want to draw a horizontal line between a photo horizontal and text section as a break.

This is my website:

Here is JSfield where it is working:

  & lt; Script type = "text / javascript" & gt; Var c = document.getElementById ("myCanvas"); Var ctx = c.getContext ("2D"); Ctx.moveTo (0,0); Ctx.lineTo (980,0); Ctx.stroke (); & Lt; / Script & gt;   

I have put it in the head here's my HTML:

    

Is there an extra space between the elements because it is clearly doing something?

Thank you!

var c = document GetElementById ("myCanvas"); is undefined object back.

Screen shot :

image here Enter details

This code should be used on line and lt; Place anywhere after canvas id = "myCanvas" width = "980" height = "100" style = "border: 0px solid #d3d3d3;" & Gt; & Lt; / Canvas & gt; & lt; Script type = "text / javascript" & gt; Var c = document.getElementById ("myCanvas"); Var ctx = c.getContext ("2D"); Ctx.moveTo (0,0); Ctx.lineTo (980,0); Ctx.stroke (); & Lt; / Script & gt;

No comments:

Post a Comment