Javascript error : HELP
Hi ,
Follow. is my javascript program. I'm getting an error
'e is undefined '
I'm not able to find it out . Could you please help me asap.
<html>
<head>
<script>
var a = 0;
var b = 0
f1(a,b);
function f1(c,d)
{
alert("f1");
var e = c;
var f = d;
document.write("<input type = button value = click onClick = 'f3(e,f)'>");
}
function f3(g,h)
{
var i = g;
var j = h;
alert("f3");
f1(i,j);
}
</script>
</head>
<body>
<form>
</form>
</html>
Thanks in advance.
-Priya
[743 byte] By [
Priyam] at [2007-9-26 1:20:05]

Hi,
I tried in both the ways but now I'm getting Syntax error.
Could you please help me?
document.write('<input type = button value = click onClick = "f3(" + e + " , " + f + ")" >');
document.write("<input type = button value = click onClick = 'f3(' + e + ' , ' + f + ')' >");
Thanks,
-Priya
you cannot write the document.write("<input type='button' value ='click' onClick='f3(" + e + "," + f +")'>");
twice
you second function calls the first that writes the statement above and erases everything else
look at he source before and after you click on the button
what are you trying to do here?
Hi,
I've follow .two functions. My array is having 30 elements. I want to populate 5 elements per page.I want to do it in javascript only.
Here is my code. Please let me know if i'm doing anything wrong.
thank you.
function printArray(mStartIndex,mEndIndex,mDataArray)
{
alert("pStartIndex = " + pStartIndex + "pEndIndex = "+ pEndIndex );
pStartIndex = mStartIndex;
pEndIndex = mEndIndex;
pDataArray = mDataArray;
document.writeln('<HTML>');
document.writeln('<TABLE BORDER = 1>');
for( var i = pStartIndex; (i < pEndIndex) && (i < pDataArray.length); i++)
{
document.writeln('<TR>');
document.writeln('<TD>');
document.writeln(pDataArray);
document.writeln('</TD>');
document.writeln('</TR>');
pStartIndex = i;
}
document.writeln('</TABLE>');
document.writeln('</HTML>');
if(pEndIndex >= pDataArray.length )
{
document.write("Next");
}
else
{
document.write("<input type = 'button' value = 'Next' onClick = 'nextRecords(" + pStartIndex + "," + pEndIndex +")'>");
}
if(pStartIndex <= 0)
{
document.write("Previous");
}
else
{
document.write('<input type = button value = Previous onClick = previousRecords()>');
}
}
function nextRecords(startIndex,endIndex)
{
alert(startIndex + " n, " + endIndex);
if (startIndex == 0)
{
}
if ((startIndex > 0) && (startIndex < xArray.length))
{
startIndex = endIndex;
endIndex = startIndex + pSize;
printArray(startIndex,endIndex,xArray);
}
}
-priya