Jump to content

Javascript InnerHTML - How to output not as plain text


DNA180

Recommended Posts

Hello everyone!!! I have install a joomla plugin by the name AllVideos Plugin. All I have to do is to put some tags like this {youtube}h2TLC0zGwKE{/youtube} somewhere in to my site and my video shows up!!! In this point I need your help... In to my php code I have add a hidden textbox that holds video's source and a div that will show video when I click on an image using javascript.Part of PHP code

<input id="video_url" name="video_url" type="hidden" value="" /><div id="video"></div>

Part of JAVASCRIPT code

var Open      = String.fromCharCode(123,121,111,117,116,117,98,101,125); // {youtube}var Close     = String.fromCharCode(123,47,121,111,117,116,117,98,101,125); // {/youtube}var video     = document.getElementById("video");var video_url = document.getElementById("video_url");...video.innerHTML =  Open+video_url.value+Close;

The problem is that youtube tags appear just as plain text! Take a look at this image:

pZvI9.jpg

 

Any idea how I will make it work??? Thank you in advance!!!

Edited by DNA180
Link to comment
Share on other sites

The problem is that the calling of plugin is run on page load and processed by server language php, which is replaced with video html code to show the video.

 

Quick solution is that you hide the generated html code to show video, within a container with specific id ref of some sort, and when you click the image with corresponding id, drag that code into the div with id video.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...