Hi guys I’m having trouble getting my code to correctly display html within the javascript code I have. basically, I am checking for the variable hundo to equal 3 and then have the script display a form. I have tested the code to just show an alert message when hundo equals 3, but when I use document.write it fails to work. My guess is the problem lies there…
<script>
setInterval(function(){
if(hundo == '3'){
document.open();
document.write("<form action="insert.php" method="post">
Link URL: <input type="text" name="linkurl" />
<input type="submit" />
</form>");
document.close();
}
}, 1000);
</script>
You need to alternate the quotes you are using in your
document.write:The problem is that you are only using one type of quotes, so javascript sees
"<form action="than an undefined javascript object:insert.php, without any operator between them, to boot.