Jump to content

Clicked Button & Transfer Script or Event Across Frame


Recommended Posts

I have a problem. How to know which button is clicked by the user and how to do it across a frame?PAGE.HTML

<html><head><script type="text/javascript" src="pathToModalScript/dhtmlModal.js"><script type="text/javascript">function OpenModal(){var MyModal=dhtmlModal(ModalData)MyModal.onClose=function(){// When button click, the modal will close and before close, all code is processed here.// My problem start here. I don't know to replace ButtonA clicked, ButtonB clicked with what conditional syntax.if (ButtonA clicked) {// Button A code. I don't have problem here.} elseif (ButtonB clicked) {// Button B code. I don't have problem here.} else {// Other button code. I don't have problem here.}// My problem end.return true //close modal after process data from modal.}}</script><body><a onClick="OpenModal()">Open My Modal</a>/* This iframe is generated on-the-fly automatically by the dhtmlModal.js when Open My Modal link is click. So the iframe is the modal window.<iframe width="100%" height="150" src="modal.html"></iframe>*/</body></html>


<html><head></head><body><form name="MyForm" id="MyForm"><input type="Button" id="ButtonA" name="ButtonA" value="Yes" onClick="parent.MyModal.hide()" /><input type="Button" id="ButtonB" name="ButtonB" value="No" onClick="parent.MyModal.hide()" /><input type="Button" id="ButtonC" name="ButtonC" value="Cancel" onClick="parent.MyModal.hide()" /></form></body></html>

How to know which button is clicked? The problem is, Modal.html is in iframe and I don't know how to create function to detect which button is clicked.I got the script here http://www.dynamicdrive.com/dynamicindex8/.../dhtmlmodal.htmAny help is really appreciated. Thanks.

Edited by Fiq
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...