PDA

View Full Version : Having Trouble w/ Iframe SSI script II



entropy71
07-31-2006, 01:03 PM
1) Script Title:
Iframe SSI script II

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

3) Describe problem:

I can't seem to get this script to work.

I have Iframe working fine, but this script doesn't seem to want to play nicely. Could someone please take a look at my source code and tell me what -- if anything -- I'm doing incorrectly. I've been playing with it for hours now and can't figure it out.

My site:

http://206.246.118.129/forum.php

***Note: I changed the style to display and removed height="0" to make it easier for me to troubleshoot, but the script didn't work even when I had it configured *exactly* like the example.

I've tried lots of little changes to the <iframe> configuration, ensured that my hostname/DNS is all working correctly, and removed other javascript functionality that might be causing a conflict.

Thanks in advance for the assistance!

jscheuer1
07-31-2006, 11:04 PM
To start with, reinstall the script making sure all line breaks remain intact.

entropy71
08-01-2006, 02:32 AM
Okay, I changed it.

Honestly I don't know why it does that as the line breaks are there as I see the special characters...sometimes I have to cut-and-paste from one text editor to another. I use Dreamweaver by default. Eh.

Unfortunately it still doesn't work, even if it does read more clearly.

Twey
08-01-2006, 03:06 AM
Yes, but now we can actually read it :)
function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
{

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>A lot of the script has been chopped off at some point.

jscheuer1
08-01-2006, 03:06 AM
Whatever you are using, somehow you have managed to reverse two of the function defining brackets (highlighted red):


function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
{

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
{

Both of these should be }, not {.

There could be other problems. But without fixing those, it can never work.

Also, just for your information, if a script is written out with strict syntax, line breaks usually can be eliminated. However, since the semicolon is often implied by a line break, if it is not there and that line break is removed, you've got trouble. Just putting semicolons at the end of all lines first is not an option, as many line breaks do not imply a semicolon. Knowledge of correct syntax is required to alter a script to be written with no line breaks.

More: You might want to look into validating (http://validator.w3.org/) your markup and testing its appearance in at least one standards compliant browser like FireFox.

entropy71
08-01-2006, 01:41 PM
Gentlemen,

Thank you. A TON! (or is that tonne?)

Anyway, it worked.

The first time around I know that those braces were the correct way because I checked and double-checked them, but after you mentioned to get the lines breaks right I went and did a cut-and-paste from this website again. Because I'm using SMARTY templates I actually have to replace the braces with a {ldelim} for the '{' and a {rdelim} for the '}' so I messed it up the second time around.

The first time I'm pretty sure the problem was the line break issue because the delimeters were correct.

The only reason I am documenting my stupidity and bad attention to detail is for future readers who may make both of these mistakes.

Thanks again for your assistance. I appreciate it greatly!

Warmest regards,

~Alec

P.S. I'll definitely look into the validation more. Thanks for the tip.