Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript functions 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do you check to see if a Javascript function exists within a page. Need to know if it's there before I call it!!

Cheers
 
Hi.

An example:

<html>
<Script Language=&quot;JavaScript&quot;>

function newWin()
{
var strm=&quot;mmde\&quot;fggrgr&quot;;
alert(strm);
}
</Script>
<body>
kekfergregreg
<input type=button value=&quot;KKKK&quot; onclick=&quot;newWin()&quot;>
<input type=button value=&quot;check&quot; onclick=&quot;javascript : try { isTrue() }catch(Exception){alert('Not valid!'); }&quot;>
</body>
</html>

The check button call an invalid method.

regards, Kirilla
 
this works for me:

function func()
{
alert('bob');
}

if(typeof(func) != &quot;undefined&quot;)
{
func();
} luciddream@subdimension.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top