Page 1 of 1

Iframe, Javascript, and PHP Tutorial

Posted: Sat Jun 12, 2004 11:06 am
by infolock
decided to remove this. Is now considered obsolete and should be instead replaced by an Ajax or XAjax tutorial..

Posted: Wed Jun 16, 2004 6:15 pm
by Zooter
I tried this. But I get no output, and also nothing happens... What can be the problem?

Posted: Wed Jun 16, 2004 10:32 pm
by d3ad1ysp0rk
What you need to have/know before reading this tutorial :
1) PHP & HTML
2) Basic calling and naming conventions of Javascript.
3) A web server and php installed.
4) A browser that supports iframes and javascript ( Note : I do not cover Netscape, only I.E. Netscape users will need to do research on the ilayer tag. this is not a very hard subject, i just chose not to lengthen this tutorial more than I already have.. The IE version recommended is 5.0+)
You check that?

Also, if it's locally hosted, make sure you navigate to localhost/file.php via a web browser, instead of double clicking the file.

Posted: Thu Jun 17, 2004 5:11 pm
by Zooter
Ok, fixed this problem as well.. I did the following.

Instead of writing

Code: Select all

function ProcessAccount() 
{ 
   var Email = '<?=$email_address; ?>'; 
   var Name = '<?=$firstname; ?>'; 
   var Surname = '<?=$lastname; ?>'; 
   window.parent.LoadTopFrame(Email,Name,Surname); 
} 
window.onload = ProcessAccount();
I wrote

Code: Select all

window.onload = function ProcessAccount() 
{ 
   var Email = '<?=$email_address; ?>'; 
   var Name = '<?=$firstname; ?>'; 
   var Surname = '<?=$lastname; ?>'; 
   window.parent.LoadTopFrame(Email,Name,Surname); 
}
and now it works, but just doesn't give the "Not implemented" error. But why?

Thanks

Posted: Fri Jun 18, 2004 12:17 pm
by infolock
Zooter wrote:and now it works, but just doesn't give the "Not implemented" error. But why?

Thanks
This was due to an error on my part. When I first wrote this article, I just kinda zoomed through the code.. Since I'm used to php's function calls (ie, myfunction() ), i kind of implimented it with javascript. Sometimes this is ok, but when using a window.onload = myfunction(); command, this does not work and generates that type of error.

This has been corrected to be window.onload = myfunction; without the ()'s... Thanks feyd and zooter. The script has been updated to reflect these changes. Sorry to anyone to which this may have caused some confusion.

Posted: Wed Jun 30, 2004 1:42 pm
by m3rajk
for those using javascript and wanting it to be M$IE compatible, here's something volka gave me that helps:

http://msdn.microsoft.com/library/defau ... frame=true

Posted: Wed Jun 22, 2005 9:40 am
by hairyjim
In FireFox this does not seem to work correctly.

In FF I get the error:

Error: parent.top.myform has no properties
Line: 10

I changed lines 10,11 and 12 from:

Code: Select all

parent.top.myform.Account.value = Account;
parent.top.myform.fName.value = Name;
parent.top.myform.Address.value = Address;
to:

Code: Select all

myform.Account.value = Account;
myform.fName.value = Name;
myform.Address.value = Address;
Everything seems to be working, not sure what the implications are of this, it still works in IE.