View Full Version : dynamic js from database

07-26-2007, 08:05 AM
title. Image description popup


Hi, Anyone know how to solve the following, if I can describe it well enough.

I am actually using another popup by sharon paine and which John at dynamic drive modified for me a while back.

The problem is the following if I can describle it well enough

I have a database with interface.
I have a webpage with javascript popups. the links are as follows
<a href="http://www.site.com" id="tip297">name</a>

in the head I have the external js file linked where all the ids are kept.
they are like this
var tip6 = '<img src="a/6.jpg"><div class="tp2">name</div>';

As I have over 300 ids the external file is big, and having a search function on the site I dont want to have to download the whole file when only a few links with ids are thrown up, but instead only the ids associated with the links found in the search.
So I am trying the following. I have an unused form field in my database interface that will insert text into the page for each link dynamically. I am trying to insert the line like this into the page.

var tip6 = '<img src="a/6.jpg"><div class="tp2">name</div>';

The insertion code is asp like this <%=rsCard("CardDescription")%>

I believe if put right it could include the js ref for each link. But anyone know how and where? In the link I have an id="" the id I get from my database like this <a id="<%=rsCard("CardDescription")%>" where "carddescription" in the interface I put tip297 for example. It all works but only when I attach the large external js file. I imagine the insertion code should go in the head but know idea how!

Any ideas.