Question : jquery dhtml use a selected dom element

Hello,

I have a link that opens a dialog window (see dialog window div).  I want to make the dialog window div dynamic in such a way that the img tag within it is based on the link used to open the div.  Basically I have a collection of image thumbnails that when clicked, I want them to open a larger version of the image in the dialog window.  I have all of it working except for making the dialog window div dynamic instead of hard-coded.  Any suggestions?

links used:
1:
2:
3:
4:
<a href="testimages/tst1.jpg" class="ui-icon ui-icon-zoomin">View Larger</a>
<a href="testimages/tst2.jpg" class="ui-icon ui-icon-zoomin">View Larger</a>
<a href="testimages/tst3.jpg" class="ui-icon ui-icon-zoomin">View Larger</a>


Dialog Window:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
<div id="dialog" title="Edit Picture">
	<form>
		<fieldset>
			<img src="testimages/tst1.jpg"/><br/> //need to make this dynamic 
			<label for="name">Caption:</label>
			<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all"/><br/>
			<label for="email">Album Cover:</label>
			<input type="checkbox" name="team" value="team">	
		</fieldset>	
	</form>
</div>


JQuery Fuctions (a tag onclick and dialog open:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
	$("#dialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 530,
			width: 545,
			modal: true,
			buttons: {
				'Save': function() {
					$(this).dialog('close');
				},
				Cancel: function() {
					$(this).dialog('close');
				}
			},
			close: function() {
				allFields.val('').removeClass('ui-state-error');
			}
		});
		$('.ui-icon-zoomin').click(function() {
			$('#dialog').dialog('open');
		})

Answer : jquery dhtml use a selected dom element

<the on click event doesn't want to do anything?>
What "OnClick" event?

You specified that this should happen...:
 "When the user clicks the close button" ("The Close button", ...meaning *the* windows standard close button, the little "X" in the upper right side of a window)
... not...
 "When the user clicks *my* close button.

So our codes are on the Close event and the Unload event receptively.

If you want the code on "Your" close button, then use code like this:

Private Sub btmClose_Click()
Dim bytAnswer As String

    If Instock.Value <> 0 Then
        bytAnswer = MsgBox("Exit now?", vbYesNo, "Exit?")
            If bytAnswer = vbYes Then
                'Do nothing
            ElseIf bytAnswer = vbNo Then
                Me.Instock.SetFocus
                Exit Sub
            End If
    Else
        'Do Nothing
    End If
   
    DoCmd.Close
End Sub

Remember here that you have not told us what other code (if any) is present on your close button already, so this code may need to be tweaked.

Finally, remember that when you code your own close button you have to be sure that you are covering all the contingencies for the various states that the data may be left in.

I am sure 2toria can post similar working code.

;-)

JeffCoachman
Random Solutions  
 
programming4us programming4us