costaf
asked on
what is wrong with this code?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>testeeeee</title>
<script language="JavaScript" type="text/javascript">
<!--
var st="!#ana@.$";
function f1(info,s)
{
for(var i=0;i<info.length;i++)
{
if (s.indexOf(info.charAt(i)) ==1)
{
return (true);
}
}
return(false);
}
if(f1(document.forms[0].el ements[0]. value,st)= =true)
{
alert("xyz");
}
else{alert("abc"); }
//-->
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<title>testeeeee</title>
<script language="JavaScript" type="text/javascript">
<!--
var st="!#ana@.$";
function f1(info,s)
{
for(var i=0;i<info.length;i++)
{
if (s.indexOf(info.charAt(i))
{
return (true);
}
}
return(false);
}
if(f1(document.forms[0].el
{
alert("xyz");
}
else{alert("abc"); }
//-->
</script>
</head>
<body>
</body>
</html>
What are you trying to accomplish and what is the code currently doing?
first look, there's not FORM element so you CAN'T USE : forms[0]
should be good to wiat total page loading with something like :
window.onload = function() { // your code here }
should be good to wiat total page loading with something like :
window.onload = function() { // your code here }
var st="!#ana@.$";
function f1(info,s) {
for(var i=0;i<info.length;i++)
{
if (s.indexOf(info.charAt(i))==1)
{
return (true);
}
}
return(false);
}
window.onload = function() {
if(f1(document.forms[0].elements[0].value,st)==true)
{
alert("xyz");
}
else
{
alert("abc");
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thx u all