Javascript - how to display a given text as string -
i learning javascript during free time. part of small project, wanted users youtube video id, width , height using html form , use write in below format.
for example, if user inputs width = 640, height = 360 , video id = ibogovrkfje, final output below:
<iframe width="input_width" height="input_height" src="http://www.youtube.com/embed/input_videoid?rel=0" frameborder="0" allowfullscreen></iframe>
when used document.write below not processed since 2 double quotes come together.
document.write "<iframe width="";
so, used html ascii " double quotes
document.write "<iframe width="";
now problem ;
the ascii ; ;
i totally @ loss, don't know how proceed, have been working on week.
sorry not point question , or alternative in regard appreciated.
thanks!
either escape doublequote:
document.write("<iframe width=\"");
or use different types of quotes:
document.write('<iframe width="');
or:
document.write("<iframe width='");
you forgot parentheses around parameter list.
for second problem, solution use entity code ampersand:
the ascii ; &#59;
Comments
Post a Comment