Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble integrating code

Status
Not open for further replies.

AlienE

MIS
Dec 8, 2002
3
US
I have "created" an image browser in a popup window (linked from a thumbnail picture) and would like to integrate text into the window for each picture as well. My preference is to put the text in an external file for ease of file maintance (a text file for instance).

My understanding of Java is very basic, but as long as I have some similar code, I can modify it to suit my needs.

My page in it's current form can be found here:
Just click on any of the tumbnail images to bring up the image browser. It takes awhile though, as the images are large and it pre-loads the image before and after the current image. Once it's loaded, it's a pretty fast script.

Thanks!
alien-e
 
not sure what you're saying... are you hoping for javascript to be able to open your text file, read the text descriptions for each picture, then diplay it? If so, can't be done. You'd have to use another scripting language (pl, php, etc as long as it can manipulate text files) and have it create the javascript on the fly.
 
On your a-popup page you should create an array of descriptions for each picture. When you load the next image, you put it's description into a <div> tag..


<script>
descriptions = new Array()
descriptions[0] = &quot;Description of picture 0&quot;
descriptions[1] = &quot;Description of picture 0&quot;
descriptions[2] = &quot;Description of picture 0&quot;

function showDescription(picNum){
thisDiv = document.getElementByID(&quot;description&quot;)
thisDiv.innerHTML = descriptions[picNum]
}
</script>

<div id=&quot;description&quot;></div>

-----------------------------------------------------------------
[pc] Be nice. It's only doing what you tell it to do.
mikewolf@tst-us.com
 
mwolf00,

It is necessary to put the description information in a seperate file to make the javascript portable. Hard coding this text into the page would not produce the desired effect. My intention is exactly what gagz said, &quot;for javascript to be able to open your text file, read the text descriptions for each picture, then diplay it&quot;. Of course, it doesn't have to be a text file. I could use the javascript to manipulate an XML document. If this is not possible, my only option is to find another approach.

I appreciate the help.
 
Sorry, no xml experience here so I don't know if javascript can do it. I do know that it can't open text files, etc. But using another language to do just that works very well, as i've done it a number of times in perl. The perl side of it gets the data from your text file/dbm file, etc and via print statements, generates your js code for the page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top