Author |
Topic  |
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 12 December 2003 : 23:48:18
|
An image is placed with the function "DisplayMedalIcon". I would like to show an alt="data from db" when hovering over the image. The red part was my guess, but naturally, doesn't do the trick.
quote: response.write DisplayMedalIcon(myMedalMembers("member_id"))& alt="myMEDALMembers("scenario")" & "</td></tr><tr><td>"
How is that done correctly? |
Alfred The Battle Group CREDO
|
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 12 December 2003 : 23:52:29
|
What does DisplayMedalIcon do ?
And this isn't .Net, it's just plain ASP  |
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 13 December 2003 : 12:15:58
|
quote: Originally posted by laser
What does DisplayMedalIcon do ?
It puts the medal graphic there.
quote: And this isn't .Net, it's just plain ASP 
you lost me here!  |
Alfred The Battle Group CREDO
|
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 13 December 2003 : 12:23:27
|
quote: Originally posted by Nikkol
you probably need to add the alt part to your DisplayMedalIcon function.
That is what I was thinking as well (truely, I did!), but the function has more than a dozen variations, and does not have the variable myMEDALMembers("scenario") available. I am uploading the txt.file for it: http://www.ggholiday.com/bg/forums/decorated.txt
The "alt=" should should the scenario name and date of issue, from the data base. |
Alfred The Battle Group CREDO
|
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 13 December 2003 : 12:38:04
|
I tried to move the function down below where the varable is introduced, and did this: quote: if mymedals("medal_ID") = 8 then DisplayMedalIcon = DisplayMedalIcon & "<img border=""0"" src=""../images/gold.gif"" width=""66"" height=""90"" alt=""myMEDALMembers("scenario")"">" end if
for each of the medals. But I get the "expected end of statement" error. |
Alfred The Battle Group CREDO
|
 |
|
snaayk
Senior Member
   
USA
1061 Posts |
Posted - 13 December 2003 : 13:55:11
|
Try this:
Change the function to this:
Function DisplayMedalIcon(m_id, alttext)
Then add the red to all your statements:
DisplayMedalIcon = DisplayMedalIcon & "<img border=""0"" src=""../images/gold.gif"" width=""66"" height=""90"" alt="""&alttext&""">"
Then call the function like this: DisplayMedalIcon(myMedalMembers("member_id"), myMEDALMembers("scenario"))
|
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 13 December 2003 : 16:15:38
|
Except that I miscoded this line now: quote: [response.write DisplayMedalIcon(myMedalMembers("member_id"), myMEDALMembers("scenario"), myMedalMembers("medal_date"))
error: quote: Error Type: Microsoft VBScript runtime (0x800A01C2) Wrong number of arguments or invalid property assignment: 'DisplayMedalIcon' /BG/forums/decorated.asp, line 106
|
Alfred The Battle Group CREDO
|
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 13 December 2003 : 16:35:16
|
quote: Originally posted by Alfred
quote: Originally posted by laser
And this isn't .Net, it's just plain ASP 
you lost me here! 
I just mean that you've posted in the .Net forum, but you're not talking about .Net, just classic ASP
quote:
Error Type: Microsoft VBScript runtime (0x800A01C2) Wrong number of arguments or invalid property assignment: 'DisplayMedalIcon' /BG/forums/decorated.asp, line 106
snaayk has redefined your code to accept 2 arguments, now with this code :
quote:
response.write DisplayMedalIcon(myMedalMembers("member_id"), myMEDALMembers("scenario"), myMedalMembers("medal_date"))
you are providing 3 arguments, so you get that error. |
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 13 December 2003 : 20:59:33
|
Does this not define three definitions?quote: if mymedals("medal_ID") = 8 then DisplayMedalIcon = DisplayMedalIcon & "<img border=""0"" src=""../images/gold.gif"" width=""66"" height=""90"" alt="""&myMedalMembers("scenario") & myMedaLMembers("Medal_date") & """>" end if
or do you mean this line? quote: Function DisplayMedalIcon(m_id, alttext, (myMedalMembers("Medal_date"))
In any event, I updated the txt file: http://www.ggholiday.com/bg/forums/decorated.txt |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 13 December 2003 21:18:48 |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 13 December 2003 : 21:16:22
|
No definitions there, just an IF (conditional) about medal #8. But in that code what is the difference between myMedalMembers and myMedal_Members ? |
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 13 December 2003 : 21:24:07
|
I only see "myMedalMembers", Laser. It comes from a select statement: quote: strSql = "SELECT MEMBER_MEDALS.MEMBER_ID, MEMBER_MEDALS.MEDAL_ID, MEMBER_MEDALS.SCENARIO, MEMBER_MEDALS.MEDAL_DATE, FORUM_MEMBERS.M_NAME, FORUM_MEMBERS.M_COUNTRY FROM FORUM_MEMBERS INNER JOIN MEMBER_MEDALS ON FORUM_MEMBERS.MEMBER_ID = MEMBER_MEDALS.MEMBER_ID order by M_NAME ASC;" set myMEDALMembers = my_Conn.Execute(strSql)
I think you misread the capitalized L as a _ ? |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 13 December 2003 21:25:56 |
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 13 December 2003 : 21:29:21
|
I can't believe it, I made a wild guess, and it works! quote: Function DisplayMedalIcon(m_id, alttext, altdate)
|
Alfred The Battle Group CREDO
|
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 13 December 2003 : 21:30:43
|
Alfred, a quick lesson in Functions ...
snaayk's code works well, changing the function definition to have 2 arguments. Arguments are always separated by commas, so you get :
Function DisplayMedalIcon(m_id, alttext)
m_id and alttext are what the 2 arguments will be called within the function.
With line 106 you are Response writing the result of the function:
response.write DisplayMedalIcon(myMedalMembers("member_id"), myMEDALMembers("scenario"), myMedalMembers("medal_date"))
111111111111111111111111111 2222222222222222222222222 3333333333333333333333333333
So you're trying to pass 3 arguments : ID, scenario and date.
Now if you want 3 arguments, it's easy - change the Function definition line, then reference the argument within the function. |
 |
|
Topic  |
|