Evening,
Instead of subscribing to yet another random javascript forum I was hoping someone here on this forum can help solve a small dilemma.
I am trying inject the Title property of an anchor with html escape codes using javascript so it would like this:
title='<a href="">example.html<a>'
The Javascript:
document.getElementById('lista' + a).title = "<a href="" + category[phpcat][a+offset][5] + ".jpg" + "">Click here to save the image</a>";
Now when the function is called to display this title it is actually printing the whole string like below:
<a href="http://www.amigaos.net/customise/background17.jpg">Click here to save the image</a>
Instead of displaying: Click here to save the image
When passing the variable across to the Title property it appears to translating the &codes first rather than leaving them intact.
This is the page I am trying to fix:
http://www.amigaos.net/customise.php?category=0
Simply click any of the background images in the gallery, you will probably have to scroll down your screen to see the caption at the bottom because I haven't changed the zoom level yet in the lightbox css.
As you can see this is a Lightbox javascript extension.
http://www.lokeshdhakar.com/projects/lightbox2/
This page goes on to explain how it is done, but only for static data, but dynamic data.
http://www.lokeshdhakar.com/projects/lightbox2/
With static data it works fine, but not if I try and pass a javascript variable into the Title property.
__________________
m4rko.com/AMIGA
Remember the property I am trying to change is .title not href, and surround the href (inside the title) with an anchor.
The .href is the jpg being open by LightBox, .title is the captioned text inside the LightBox.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
Well still no luck here fixing the final remaining pages of my site.
http://www.amigaos.net/customise.php?category=0
My have to just do away with the caption inside the lightbox and instead have 2 additional fields under each listing.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
SOLVED! Went against my better judgement, inserted html code directly into .title property instead of special entities works a treat.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
Hi all,
Perhaps someone can fix a javascript function for me, it supposed to sort an array by the 6th element (the datestamp) - it works correctly in Safari, but displays nothing in FF. :o
function sortByColumn(a,b) {
a = a[6];
b = b[6];
return a == b ? 0 : (a > b ? -1 : 1)
}
Calling it like this: article.sort(sortByColumn); shows sorted list in Safari, nothing in FF
Curiously if I call it like: article.sort(sortByColumn()); Safari now shows an unsorted list as does FF.
As I have lifted the code from another site, I don't fully appreciate it how it works, but suffice to say the result isn't ideal. ^.^
Array structure below.
Online page resource: http://www.amigaos.net/articles.php
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
So anyone got a solution yet?
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
Updated article[0] to remove target="blah blah" error:
Still now working so that wasn't it.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide
Seen as though I couldn't find a way to do it with Javascript, articles are now stored in a .csv file which is read when the page is loaded and echoed to the page. Just gotta remedy prev/next page buttons now on this page and carry through the changes to the associated getarticles.php page.
AmigaOS.net - Discover Amiga, Discover AmigaOS.net
Jack for AmigaOS
Samba Idiot's Guide