How do i change the onClick() value when it is called in a function? Here is the code I have stripped it down to bare bones.
First time you click it enables the form the second time I want it to alert user its under construction. Im sure its very simple to fix and my syntax is incorrect namely this line
Code:document.form2.edit.onclick()=alert('under construction');
Code:<html> <head> <title>Script</title> <script language="Javascript"> function enableForm() { document.form2.regionID.disabled=false; document.form2.selectArea.disabled=false; document.form2.edit.value="Upload changes"; document.form2.edit.onclick()=alert('under construction'); } </script> </head> <body> <form name="form2"> <input type="text" name="region" size="25" id="regionID" disabled="disabled"> <select name="Region" disabled="disabled" id="selectArea"> <option value="scotland">Scotland</option> <option value="north_west">North West</option> <option value="north_east">North East</option> <option value="west_midlands">West Midlands</option> <option value="east_midlands">East midlands</option> <option value="wales">Wales</option> <option value="anglia">Anglia</option> <option value="london">London</option> <option value="south_west">South West</option> <option value="south_east">South East</option> </select> <input type="text" name="regionid" size="1" id="regionid" disabled="disabled"> <input type="button" id="edit" value="Edit" onClick="enableForm();"> </form> </body> </html>


Reply With Quote

Bookmarks