W
w i l l
I am beginning JavaScript, expect to see me in here a bit more over
the next few months I am currently writing some HTML with
JavaScript. As you know HTML has many double quotes ( " ) when
declaring attibute values, I know in some cases quotes are optional,
but I like them.
Here is something I've been playing with , it works, but in my
opinion, it's ulgy...
<script>
var myArray = new Array("blue","green","red");
for(var i = 0; i < myArray.length; i++) {
document.write("<input type=\"submit\" value=\"" + myArray +"\"
onClick=\"document.bgColor='" + myArray +"'\">");
}
</script>
Is there any way to mix javascript variables in with HTML without
having to excape all of the qoutes?
a perlish solution would be the qq operatior. but I know of nothing in
javascript. Is there anything?
perlish example...
document.write(qq` an example of " any text" ... `);
TIA
w i l l
the next few months I am currently writing some HTML with
JavaScript. As you know HTML has many double quotes ( " ) when
declaring attibute values, I know in some cases quotes are optional,
but I like them.
Here is something I've been playing with , it works, but in my
opinion, it's ulgy...
<script>
var myArray = new Array("blue","green","red");
for(var i = 0; i < myArray.length; i++) {
document.write("<input type=\"submit\" value=\"" + myArray +"\"
onClick=\"document.bgColor='" + myArray +"'\">");
}
</script>
Is there any way to mix javascript variables in with HTML without
having to excape all of the qoutes?
a perlish solution would be the qq operatior. but I know of nothing in
javascript. Is there anything?
perlish example...
document.write(qq` an example of " any text" ... `);
TIA
w i l l