Jump to content
shaffiq_fiq88

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>

MODAL.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

Share this post


Link to post
Share on other sites

Change the onclick to have it call a function and tell the function what button was clicked.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...