Skip to content Skip to sidebar Skip to footer

Unable To Get Elements Passed From Html

i'm having the below jsp page created. <%@page contentType='text/html' pageEncoding='UTF-8'%>

Solution 1:

Check this code:

<html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>JSP Page</title><scripttype="text/javascript">functionshow(x,y)
    {
        document.getElementById(x).style.display='block';
        document.getElementById(y).style.display='none';
        document.getElementById('Ship_IDl').style.display='block';
    }
functionhide(x,y)
    {
        document.getElementById(x).style.display='none';
        document.getElementById(y).style.display='block';
        document.getElementById('Ship_IDl').style.display='none';
    }
functionhandleKeyEvent(e) {
var charCode;
if (e && e.which) {
    charCode = e.which;
} elseif (window.event) {
    e = window.event;
    charCode = e.keyCode;
}
if (charCode == 13) {
    //document.getElementById("yourForm").submit();var m=document.getElementById(e);
    alert(m);
            hide(x);
}
}
</script></head><body><formname="form1"method="post"action="abc.jsp"><tablewidth="722"><tr><tdwidth="431"height="190"><tablewidth="439" ><tr><tdwidth="129">PARTS Updated</td><tdwidth="108"><p><selectname="PARTS_Updated"id="PARTS_Updated" ><optionvalue=""></option><optionvalue="N/A">N/A</option></select></p></td><tdwidth="186"><labelfor="PARTS_Updated"></label></td></tr><tr><td>TSI OK&#13;</td><td><p><inputtype="radio"name="radio"id="TSI_N/A"value="TSI_N/A"onClick="hide('TSI_Query_Box','SI_Query_Box')">
                N/A
              </p><p><inputtype="radio"name="radio"id="TSI_Query"value="TSI_Query"onClick="show('TSI_Query_Box','SI_Query_Box')">              TSI Query</p></td><td><labelfor="TSI_Query_Box"></label><textareaname="TSI_Query_Box"id="TSI_Query_Box"cols="15"rows="5"style="display:none"onkeypress="handleKeyEvent('TSI_Query_Box')"></textarea></td></tr><tr><tdheight="65">Special Ins OK&#13;</td><td><p><inputtype="radio"name="radio"id="SI_N/A"value="TSI_OK"onClick="hide('SI_Query_Box','TSI_Query_Box')">
                N/A
              </p><p><inputtype="radio"name="radio"id="SI_Query"value="SI_Query"onClick="show('SI_Query_Box','TSI_Query_Box')"> SI Query</p></td><td><labelfor="SI_Query_Box"></label><textareaname="SI_Query_Box"id="SI_Query_Box"cols="15"rows="5"style="display:none"onkeypress="handleKeyEvent('SI_Query_Box')"></textarea></td></tr></table></td><tdwidth="279"><tablewidth="279"align="center"><tr><tdwidth="87"><p>Shipment ID&#13;</p></td><tdwidth="97"><labelfor="Ship_ID"></label><inputtype="text"name="Ship_ID"id="Ship_ID"></td></tr></table></td></tr></table><p>&nbsp;</p><tablewidth="721"border="1"><tr><tdwidth="374"align="center"><inputtype="submit"name="Send for CT Review (SCTR)"id="Send for CT Review (SCTR)"value="Send for CT Review (SCTR)"></td><tdwidth="331"align="center"><inputtype="submit"name="CT Review Complete (CTRC"id="CT Review Complete (CTRC)"value="CT Review Complete (CTRC)"></td></tr><tr><tdalign="center"><inputtype="submit"name="Cleanup Queries"id="Cleanup Queries"value="Cleanup Queries"></td><tdalign="center"><inputtype="submit"name="Cleanup  Complete"id="Cleanup  Complete"value="Cleanup  Complete"></td></tr><tr><tdcolspan="2"align="center"><inputtype="submit"name="Go_To_Main_Page"id="Go_To_Main_Page"value="Go To Main Page"></td></tr></table><p>&nbsp;</p></form><h1>&nbsp;</h1></body></html>

Solution 2:

Check this:

<html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>JSP Page</title><scripttype="text/javascript">functionshow(x,y)
    {
        document.getElementById(x).style.display='block';
        document.getElementById(y).style.display='none';
        document.getElementById('Ship_IDl').style.display='block';
    }
functionhide(x,y)
    {
        document.getElementById(x).style.display='none';
        document.getElementById(y).style.display='block';
        document.getElementById('Ship_IDl').style.display='none';
    }

functionmyKeyPress(e,x,y){
    var keynum;
    if(window.event){ // IE
        keynum = e.keyCode;
    }elseif(e.which){ // Netscape/Firefox/Opera
        keynum = e.which;
    }
    //alert(String.fromCharCode(keynum));//alert(keynum);if (keynum == 13) {
        //document.getElementById("yourForm").submit();var m=document.getElementById(x).value;
        alert(m);
        hide(x,y);
    }
}
    </script></head><body><formname="form1"method="post"action="abc.jsp"><tablewidth="722"><tr><tdwidth="431"height="190"><tablewidth="439" ><tr><tdwidth="129">PARTS Updated</td><tdwidth="108"><p><selectname="PARTS_Updated"id="PARTS_Updated" ><optionvalue=""></option><optionvalue="N/A">N/A</option></select></p></td><tdwidth="186"><labelfor="PARTS_Updated"></label></td></tr><tr><td>TSI OK&#13;</td><td><p><inputtype="radio"name="radio"id="TSI_N/A"value="TSI_N/A"onClick="hide('TSI_Query_Box','SI_Query_Box')">
                N/A
              </p><p><inputtype="radio"name="radio"id="TSI_Query"value="TSI_Query"onClick="show('TSI_Query_Box','SI_Query_Box')">              TSI Query</p></td><td><labelfor="TSI_Query_Box"></label><textareaname="TSI_Query_Box"id="TSI_Query_Box"cols="15"rows="5"style="display:none"onkeypress="return myKeyPress(event,'TSI_Query_Box','SI_Query_Box')"></textarea></td></tr><tr><tdheight="65">Special Ins OK&#13;</td><td><p><inputtype="radio"name="radio"id="SI_N/A"value="TSI_OK"onClick="hide('SI_Query_Box','TSI_Query_Box')">
                N/A
              </p><p><inputtype="radio"name="radio"id="SI_Query"value="SI_Query"onClick="show('SI_Query_Box','TSI_Query_Box')"> SI Query</p></td><td><labelfor="SI_Query_Box"></label><textareaname="SI_Query_Box"id="SI_Query_Box"cols="15"rows="5"style="display:none"onkeypress="return myKeyPress(event,'SI_Query_Box','TSI_Query_Box')""></textarea></td></tr></table></td><tdwidth="279"><tablewidth="279"align="center"><tr><tdwidth="87"><p>Shipment ID&#13;</p></td><tdwidth="97"><labelfor="Ship_ID"id="Ship_IDl"></label><inputtype="text"name="Ship_ID"id="Ship_ID"></td></tr></table></td></tr></table><p>&nbsp;</p><tablewidth="721"border="1"><tr><tdwidth="374"align="center"><inputtype="submit"name="Send for CT Review (SCTR)"id="Send for CT Review (SCTR)"value="Send for CT Review (SCTR)"></td><tdwidth="331"align="center"><inputtype="submit"name="CT Review Complete (CTRC"id="CT Review Complete (CTRC)"value="CT Review Complete (CTRC)"></td></tr><tr><tdalign="center"><inputtype="submit"name="Cleanup Queries"id="Cleanup Queries"value="Cleanup Queries"></td><tdalign="center"><inputtype="submit"name="Cleanup  Complete"id="Cleanup  Complete"value="Cleanup  Complete"></td></tr><tr><tdcolspan="2"align="center"><inputtype="submit"name="Go_To_Main_Page"id="Go_To_Main_Page"value="Go To Main Page"></td></tr></table><p>&nbsp;</p></form><h1>&nbsp;</h1></body></html>

Post a Comment for "Unable To Get Elements Passed From Html"