0

I was wondering if someone could help me, I created this JavaScript variable called embed it contains some HTML. I was wondering how I would go about outputting the html in the variable.

var hostname = "http://www.justin.tv/widgets/live_embed_player.swf?channel="+channelname+"\" id=\"live_embed_player_flash\" height=\"700\" width=\"1280\" bgcolor=\"#000000\">http://www.justin.tv/widgets/live_embed_player.swf\" />"

Anyone who can help I would really appreciate it.

2
  • What kind of output html do you want? can you give an example of what should end up in the page? Commented Feb 3, 2013 at 1:47
  • I cut it off by accident it posted it in the comments on the response below. It's an embed code, I'm trying to get it to display the video player embed on a page. After a user feeds the channel name. If you are willing to help I can let you look at my live editor with the code. Commented Feb 3, 2013 at 2:27

1 Answer 1

0

To output your HTML inside another element:

document.getElementById("parent-element").innerHTML = hostname;
9
  • I've tried that and then placed <div id='parent-element'></div> in the body after doing that, but nothing happens. Am I missing something here? Commented Feb 3, 2013 at 2:13
  • @user2036348 Your hostname is not valid HTML - you need to have < ></ > or < /> and you only have > / >. Commented Feb 3, 2013 at 2:20
  • <object type=\"application/x-shockwave-flash\" data=\"justin.tv/widgets/…"\" id=\"live_embed_player_flash\" height=\"700\" width=\"1280\" bgcolor=\"#000000\"><param name=\"allowFullScreen\" value=\"true\"/><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"allowNetworking\" value=\"all\" /><param name=\"movie\" value=\"justin.tv/widgets/live_embed_player.swf\" /><param name=\"flashvars\" value=\"hostname=www.justin.tv&channel="+channelname+"&auto_play=false&start_volume=25\" /></object>" Commented Feb 3, 2013 at 2:24
  • I just cut it off by accident Commented Feb 3, 2013 at 2:25
  • @user2036348 Make sure channelname is set and that your embed is linking to a URL that actually exists. If you're still having problems after that, I can't really help without seeing more of your source code - the JS I provided is fine and should work properly. Commented Feb 3, 2013 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.