T
tux090
Hi All,
I am new to html programming. I am having a page which has 4 buttons.
And I have limitation that I have to have all the buttons of type
SUBMIT only and the order of the buttons is also fixed.
But I am facing problem with functionality of the page. I am attaching
a sample code here for the reference.
<html><head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>
<script type="text/javascript" language="JavaScript1.2" >
function displayShow() {
alert("Show button pressed...");
}
function displaySubmit() {
alert("Submit button pressed...");
}
function displayReset() {
alert("Reset button pressed...");
}
</script>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="1375"
height="447">
<tr>
<td valign="top" height="447" width="1375">
<form method="POST" name="testForm" action="./test.htm">
<p> </p><p> </p>
<p>Message: <input type="text" name="T1" size="20"></p>
<p> </p><p> </p><p>
<input type="submit" value="Show" name="B1"
onkeypress="displayShow()" >
<input type="submit" value="Submit" name="B2"
onkeypress="displaySubmit()" >
<input type="submit" value="Reset" name="B3"
onkeypress="displayReset()" >
</p>
</form>
<p> </td>
</tr>
</table>
<script type="text/javascript">
document.testForm.B2.focus();
</script>
</body></html>
The page has Show, Submit, Reset buttons, all are of type submit. When
I press enter I want submit button should be executed but show button
get executed. And also with respect to button focus, by default Show
button takes the button focus when I click in the text box, I want to
have it on submit button when normal focus is on text box, so that
submit routine should be called when I press enter.
I tried with few java scripts but didn't work out.
Can anybody please help in this regard.
Thanks in advance.
Regards,
Prashant.
I am new to html programming. I am having a page which has 4 buttons.
And I have limitation that I have to have all the buttons of type
SUBMIT only and the order of the buttons is also fixed.
But I am facing problem with functionality of the page. I am attaching
a sample code here for the reference.
<html><head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>
<script type="text/javascript" language="JavaScript1.2" >
function displayShow() {
alert("Show button pressed...");
}
function displaySubmit() {
alert("Submit button pressed...");
}
function displayReset() {
alert("Reset button pressed...");
}
</script>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="1375"
height="447">
<tr>
<td valign="top" height="447" width="1375">
<form method="POST" name="testForm" action="./test.htm">
<p> </p><p> </p>
<p>Message: <input type="text" name="T1" size="20"></p>
<p> </p><p> </p><p>
<input type="submit" value="Show" name="B1"
onkeypress="displayShow()" >
<input type="submit" value="Submit" name="B2"
onkeypress="displaySubmit()" >
<input type="submit" value="Reset" name="B3"
onkeypress="displayReset()" >
</p>
</form>
<p> </td>
</tr>
</table>
<script type="text/javascript">
document.testForm.B2.focus();
</script>
</body></html>
The page has Show, Submit, Reset buttons, all are of type submit. When
I press enter I want submit button should be executed but show button
get executed. And also with respect to button focus, by default Show
button takes the button focus when I click in the text box, I want to
have it on submit button when normal focus is on text box, so that
submit routine should be called when I press enter.
I tried with few java scripts but didn't work out.
Can anybody please help in this regard.
Thanks in advance.
Regards,
Prashant.