I am new to javascript. I have snippet wherein i am giving a brief note on what i am trying to do. In the below have a variable by name stuff. trying to reset the page. Part of the code which does reset is attached below.
there is a reset button which will reset the connection and it takes two min for data loading during which the reset button has to be disabled and later after two mins it should enable the button for the user.
Expand|Select|Wrap|Line Numbers
- stuff = "<form name=" + tagName + " action=common/setitem.php method=POST target=_self>";
- stuff += "<input type=hidden name=PSET value=LEAF>";
- stuff += "<input type=hidden name=" + tagID + " value=" + Reset + " >";
- if (model == romit)
- {
- stuff += "<input type=submit id=submit_id value=\"Reset\" onclick=\"return do_reset();\">";
- setTimeout("document.getElementById('submit_id').disabled=false", 120000);
- }
- stuff += "</form>";
- writeSingleTableRow(stuff, "");
- }
- }
- writeBodyTail();
- function do_reset()
- {
- var update;
- update = confirm(' takes 2 mins please wait...');
- if(update)
- {
- document.getElementById('submit_id').disabled = 'true';
- return true;
- }
- else
- return false;
- }
disable and enable part is not added to the stuff. Is thr any way of adding it to stuff. In this case its just disabling and enabling the reset button fine but actual reset is not happening.
instead of the above if just by doing this
Expand|Select|Wrap|Line Numbers
- function do_reset()
- {
- var update;
- update = confirm(' takes 2 mins please wait...');
- if(update)
- {
- return true;
- }
- else
- return false;
- }
Also,
tried to change with this
Expand|Select|Wrap|Line Numbers
- stuff += "<input type=submit id=submit_id value=\"Reset Integrated Lights-Out 2\" onclick=\"this.disabled='true';return true;\">";
Expand|Select|Wrap|Line Numbers
- stuff += "<input type=submit id=submit_id value=\"Reset Integrated Lights-Out 2\" onclick=\"document.getElementById('submit_id').disabled='true';return true;\">";
Please suggest what needs to be done.