Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 17 people (76%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How do I check if a form exist in a frame ?

Apr 6th, 2008 18:50
ha mo, Luiz Paulo Rosa, Francesco Defazio, chris ker,


You can do it using try catch. For example you can do in this way:
try{
	var a = document.frmTest.name;
	alert("The form " + a + " is present!");
	var b= document.frmTest2.name;
	alert("The form "+ b + " is present!");
}catch(e){
	alert("someone form not exist!");
}
If in your page exist a form called frmTest and a form called frmTest2 
the execution not enter in a catch statement. Otherwise if isn't 
present one of them an exception are throw.
Excuse me for my english!
Bye.
Francesco Defazio
//---------------------------------------
Or 
Try the 'eval' command:
eval(parent.myFrame.myForm)
The command above returns true if the form myForm exists in the frame 
myFrame.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com