Reputation: 2037
I'm trying to insert a JS variable in html tags and I don't know what I'm doing wrong. The movie does not load. Here is my code:
var moviePath = "images/main.swf";
<script>document.write('<PARAM name="movie" value="' + moviePath + '">')</script>
Upvotes: 0
Views: 9117
Reputation: 7233
Your var seems to be outside of your script..?
Try:
<script type="text/javascript">
var moviePath = "images/main.swf";
document.write('<param name="movie" value="' + moviePath + '">');
</script>
Upvotes: 6