Hello
I have a window call A.html that contains an iframe called B.php
B.php determines what its content should be in HTML and it holds that info in a PHP variable called $content
That means that the value of $content is now something like:
[code]
<table border=”2″ cellspacing=”0″ width=”100%”>
<tr>
<td>
<span style=”font-family: ‘Arial, Helvetica, sans-serif’>Hello</span>
</td>
</tr>
</table>
Note that the code contains both ” and ‘
Now in the iframe onload event I want to pass the content of the $content variable to the innerHTML value of some div in A.html
I do the following:
[code=php]
function onLoad() {
var divElement = parent.document.getElementById(‘div’);
divElement.innerHTML = ‘<?php print $content; ?>’;
}
Now note that the single ‘ that enclouses the value of the innerHTML. They interfere with the ‘ and ” that are part of the content of $content
How can I solve this problem and pass any arbitrary HTML content between pages by using JavaScript?
regards
Help would be appreciated