I'm working on a function for a page that (simplified) looks like this: <script language="javascript" type="text/javascript"> if (parent.frames.length != 0) { document.write("Loaded in frames!") } </script> PHP: My question is somewhat odd. Basically, is there a way to insert a larger amount of HTML output (instead of just "Loaded in frames!" or "Not loaded in frames!") within the function that doesn't rely on document.write()? An analogy in PHP would be something like this: <? $var = 1; if ($var == 1) { ?> Hi there mom! <? } PHP: This echoes the HTML inside the function if and only if the "if" statement is met, but isn't forced to use echo() or print() or any such PHP function to do it. It's probably something easy, I'm just not that good at JS yet. Thanks for the help! -Alex
Sorry to disappoint you but there's no other way. php files are parsed and everything outside the <? ?> tags is echoed to the browser (well, actually not everything, cause as you said your code will execute only if the if is true), but in js you have to explicitly tell the script where you want it to write. There are other possibilities, but document.write() is the easiest one in that case.
I guess I'd put all HTML in a hidden DIV, and tell Javascript to make this DIV visible, based on your condition.
Is there anything like the EOT function of PHP in JS, so it wouldn't be dependent on quotes that might get broken in the HTML?