Hi All;
I'm having trouble figuring out a way for the code I need to write.
The situation is this:
I have a HTML page, in which I have 2 checkboxes & underneath each is a textbox. I have 1 SUBMIT button. I enter data in a textbox & Select the corresponding checkbox & hit submit, the data gets displayed properly. But the PROBLEM is when I select both the CHECKBOXES for both the textboxes data to get displayed, when hit SUBMIT. I get to see only the First Textbox data always OR If I comment the FIRST IF BLOCK then I'll see the second textbox data. So, NOT BOTH data together?!?!?!
Can anyone help me solve this puzzle.
Below is the Code I'm struggling on.
-----------------------------------------
<html>
<head>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0">
<form name="frm1">
<center>
<table border='0' cellspacing=2 cellpadding=3>
<TR>
<TD align="left" valign="middle"><font size=2><b>CB1</b>
<TD align="left" valign="middle"><font size=2><b>TEXTBOX_1</b>
<TR>
<TD align="left"><input type = "checkbox" name="cb1" value="ON" checked="checked" size =25>
<TD align="left"><input type = text name="textbox1" size =25>
<TR>
<TD align="left" valign="middle"><font size=2><b>CB2</b>
<TD align="left" valign="middle"><font size=2><b>TEXTBOX_2</b>
<TR>
<TD align="left"><input type = "checkbox" name="cb2" value="ON" checked="checked" size =25>
<TD align="left"><input type = text name="textbox2" size =25>
</table>
<table>
<TR>
<Td align=left><input type=submit name="submit" value="SUBMIT" size=15 onClick="submitQry();return false;">
</table>
</CENTER>
</form>
<script language="javascript">
<!-- hide me
function submitQry()
{
var the_string;
var the_string1;
if(document.add_links1.cb1.checked==true)
{
//alert("in IF 1..."
;
the_string=document.frm11.textbox1.value;
document.write("<b>"+the_string);
document.write("<b>"+the_string);
}
if(document.frm1.cb2.checked==true)
{
the_string1=document.frm1.textbox2.value;
//document.writeln("<table>"
;
document.write("<tr>"
;
document.write("<b>"+the_string1);
//document.writeln("</table>"
;
}
else
document.writeln("No Data to display!!!"
;
}
// show me -->
</script>
</body>
</html>
I'm having trouble figuring out a way for the code I need to write.
The situation is this:
I have a HTML page, in which I have 2 checkboxes & underneath each is a textbox. I have 1 SUBMIT button. I enter data in a textbox & Select the corresponding checkbox & hit submit, the data gets displayed properly. But the PROBLEM is when I select both the CHECKBOXES for both the textboxes data to get displayed, when hit SUBMIT. I get to see only the First Textbox data always OR If I comment the FIRST IF BLOCK then I'll see the second textbox data. So, NOT BOTH data together?!?!?!
Can anyone help me solve this puzzle.
Below is the Code I'm struggling on.
-----------------------------------------
<html>
<head>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0">
<form name="frm1">
<center>
<table border='0' cellspacing=2 cellpadding=3>
<TR>
<TD align="left" valign="middle"><font size=2><b>CB1</b>
<TD align="left" valign="middle"><font size=2><b>TEXTBOX_1</b>
<TR>
<TD align="left"><input type = "checkbox" name="cb1" value="ON" checked="checked" size =25>
<TD align="left"><input type = text name="textbox1" size =25>
<TR>
<TD align="left" valign="middle"><font size=2><b>CB2</b>
<TD align="left" valign="middle"><font size=2><b>TEXTBOX_2</b>
<TR>
<TD align="left"><input type = "checkbox" name="cb2" value="ON" checked="checked" size =25>
<TD align="left"><input type = text name="textbox2" size =25>
</table>
<table>
<TR>
<Td align=left><input type=submit name="submit" value="SUBMIT" size=15 onClick="submitQry();return false;">
</table>
</CENTER>
</form>
<script language="javascript">
<!-- hide me
function submitQry()
{
var the_string;
var the_string1;
if(document.add_links1.cb1.checked==true)
{
//alert("in IF 1..."
the_string=document.frm11.textbox1.value;
document.write("<b>"+the_string);
document.write("<b>"+the_string);
}
if(document.frm1.cb2.checked==true)
{
the_string1=document.frm1.textbox2.value;
//document.writeln("<table>"
document.write("<tr>"
document.write("<b>"+the_string1);
//document.writeln("</table>"
}
else
document.writeln("No Data to display!!!"
}
// show me -->
</script>
</body>
</html>