Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

onMouseOver Event for Repeat Region

Posted 17 Nov 2004 07:47:04
1
has voted
17 Nov 2004 07:47:04 Steve Zobrist posted:
I'm not sure if this can be done, but I would like to set up the following:

1. Using Dreamweaver MX 2004, create a repeat region populated by data from a MS-SQL database (no problems here). Approximately 20-30 records will be displayed at most.

2. When a user moves the mouse pointer over a record such as a part number (onMouseOver), a comment will appear (the part description) which is stored as a field value in the table/view.

3. Alternatively (if the above isn't possible), if the user clicks on the field, a comment from the table/view will appear.

Any ideas? I'm not the worlds greatest programmer, but I can sometimes pick apart a script and adapt it.

Thanks!

Replies

Replied 17 Nov 2004 21:31:32
17 Nov 2004 21:31:32 Simon Martin replied:
You could create a <title> tag for each link and populate it dynamically with the 'part description' taken from the database. That would give you a 'tool tip' type effect when you mouseover.
e.g. title="<%= rsWhatever("part_desc" %>"
If some fields will be blank then you should wrap that up in an IF statement

Here's one I did earlier that dynamically builds the title tag but only if there is a record to display

<% if rsClubs("email" <> "" then response.Write("<a href='contact.asp?dojoEmail=" & (rsClubs("email") & "' title='Send " & (rsClubs("contact_name") & " an email'>" & (rsClubs.Fields.Item("contact_name".value) & "</a>" else response.Write(rsClubs.Fields.Item("contact_name".Value) end if %><br />

Otherwise to have the user click on a field you have 2 options:
1. you could use the dmx behaviour Open Browser Window, give the window a nice small size and no controls - display the description in there - but then the user would have to close the detail window
2. using Layers and a bit of DHTML (i'm not so good at this stuff) show the layer with the description in when they mouseover or click your link

HTH


Live the life you love
Love the life you live

Simon

[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]
Replied 18 Nov 2004 07:24:21
18 Nov 2004 07:24:21 Steve Zobrist replied:
Simon,

Thanks for the help. Taking some of your ideas, I adapted them to a slightly different solution.

I "cheated" a lot and grabbed a java script at www.dynamicdrive.com/dynamicindex5/texttool.htm. Then I changed the <a href ....> to just <a ....> at the beginning of each record in the repeat region (I didn't want a hyperlink). In other words I inserted:
<a onMouseover="showtip(this,event,'<%=(rsClubs.Fields.Item("contact_name".Value)%>')" onMouseout="hidetip()">
just before the field definition <%=(rsClubs.Fields.Item("contact_name".Value)%>

The whole thing looks like (for one cell):
<td class="style3"><a onMouseover="showtip(this,event,'<%=(rsClubs.Fields.Item("contact_name".Value)%>')" onMouseout="hidetip()"><%=(rsClubs.Fields.Item("contact_name".Value)%></a></td>

Voila! It does the mouse over just beautifully!

Thanks for your help. It got me headed in the right direction.

Ciao for Now,

Steve
Replied 18 Nov 2004 11:49:09
18 Nov 2004 11:49:09 Simon Martin replied:
Cool

One suggestion; if it is <i>important</i> that your comment is accessible you might consider an alternative method to the javascript for those people that have js disabled.

Live the life you love
Love the life you live

Simon

[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]

Reply to this topic