Iframe, Javascript, and PHP Tutorial

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Iframe, Javascript, and PHP Tutorial

Post by infolock »

decided to remove this. Is now considered obsolete and should be instead replaced by an Ajax or XAjax tutorial..
Last edited by infolock on Wed Sep 14, 2005 10:09 am, edited 17 times in total.
Zooter
Forum Commoner
Posts: 45
Joined: Tue May 18, 2004 10:46 am
Location: South Africa

Post by Zooter »

I tried this. But I get no output, and also nothing happens... What can be the problem?
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post 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.
Zooter
Forum Commoner
Posts: 45
Joined: Tue May 18, 2004 10:46 am
Location: South Africa

Post 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
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post 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.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post 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
hairyjim
Forum Contributor
Posts: 219
Joined: Wed Nov 13, 2002 9:04 am
Location: Warwickshire, UK

Post 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.
Post Reply