View Full Version : How to get onclick value from button which is there in hidden div?

04-27-2011, 07:34 PM
Hi All, i am veera. i have one hidden div which has ok and cancel button. i have kept this in showmydiv.html file. i have another file called upload.html which has one button to upload a file. on onclick of upload-button(onclick=confirmsubmit(); )..in this confirmsubmit(), i am calling another function to enable hidden div in javascript. like


var x=showmydiv(divid);
alert("div popup");


when i click on the upload button, i am able to get the div visible but the problem is the flow of execution does not stoped till click ok or cancel in div popup.

i would like to stop the flow till click either ok or cancel.when i click ok or cancel then the next statement (ex:alet("div popup"); ) has to execute.
when i click on OK it has to come back to called place with return true and cancel has to return false....please help me..

Thank you

sample code:
<div id="dividv" class="popup">

<table border="0" height="130px" cellspacing="0" cellpadding="0" class="border-table">
<tbody style="background: #ffffff">
<tr border="0" bgcolor="#ACC6DF" height="22px">
<td align="left" valign="center" style="font-family: arial;font-size: 12px; padding-left: 5px;" id="hdMsg"> Delete
<td align="right" valign="center">
<a href="#" class="poplink" onclick="hidemydiv('divid');return false;" id="link">
<img src="delete.gif" border="0"></a></td>
<td style="padding-top: 15px; padding-bottom: 10px;">
<table width="100%">
<td width="40%" style="padding-left: 10px;" align="center" >
<input id="YesBtn" type="button" name="page" style="cursor: pointer;" value="OK" class="button">
<input type="button" name="page" style="cursor: pointer;" value="Cancel" class="button" id="NoBtn">

function showmydiv(divid)
var divobj = document.getElementById(divid);
divobj.style.display = "none";
return true;
// break;


<td align="center" valign="top" colspan="3" style="padding-top: 10px; padding-left:10px;">

<a href="#" onClick="if (confirmSubmit()) document.config_backup_restore.submit();" id="restore-link" name="restore-link" class="button" title=""></a>

the above code is for reference...

04-28-2011, 11:30 PM
are you trying to put in a confirmation box that returns a value?

<script type="text/javascript">
function get_return_value()
{if (confirm('Please click ok or cancel.')) {return true;};}

return_val = get_return_value();

case true:
alert('you clicked ok');
//document.getElementById('whatever').display ='';

04-29-2011, 05:06 AM
HI Falkon303,

Thank you for your replay. i am not using any confirm or alerts. actually my requirement replacing the alert or confirm boxs. as i explained in previous message, when i click on the button which is in divpop , it needs to return the value to showmydiv(divid). this has to wait for return value from OK or cancel button.

05-09-2011, 05:29 PM
You want to send the value *before* you apply a "display:none;" attribute, or the element won't be seen as existing.