Hi,

I am trying to disable the 'start' button after i click on 'start' button. Its not working.

Please help.

<html>
<SCRIPT language="JavaScript">
<!--hide
function newtext()
{
document.myform.mytext.disabled = true;
setTimeout("moretext()",9000);
 }

function moretext()
{
document.myform.one.disabled = true;
}
//-->
</SCRIPT>

</HEAD>

<BODY>

<FORM name="myform" method="post" action="sessionS1.php">

<table width='600' cellpadding='5' cellspacing='5' border='1'> 

<tr><td colspan=6 align='right'><INPUT class = "button" TYPE="button" name= "mytext" value="start " onClick="newtext()"></td></tr>
<tr> <td> 2 * 4 </td>  <td> <input type = 'text' size = '2' name = one > </td> </tr>
<tr><td colspan=6 align='right'><input type='submit' value='Score' name='btn_score'></td></tr> 

</table> 

</FORM>

</body>
</html>

Recommended Answers

All 3 Replies

i got your code and its working on mine maybe you should try
to test if the function being called .. as connected to the event...

please check if theres an error on your script
for client side if you are using a firefox browswer press 'control+shift+j' to show the error console check if theres an error

document.getElementsByName("mytext")[0].disabled = true;

Your code is working, disabled the 'start' button after i click on 'start' button.

And If you want to hide this button after click, you can use ...

function newtext()
{
document.myform.mytext.style.display = 'none';
setTimeout("moretext()",9000);
 }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.