View Full Version : Loading text to page

02-09-2004, 01:18 PM
Hello everyone:

I'm working on my department Intranet and I need to set a behaviour for links. When you click on a link some text has to come up on the other side of the page. I'm not using frames (and I can't) and I can't use Flash either. I wonder if there's any way of doing this in JavaScript without creating pop up windows or alerts. Maybe some other scripting language?.

I'll appreciate your help in the matter.

Thanks a lot,


02-09-2004, 02:06 PM
Where is this text stored in the first place? Can it be part of the page itself?

02-09-2004, 02:14 PM
I haven't got it stored anywhere yet. I was thinking of using an array or document.write?, but I'm not sure since I'm not completely versed in JavaScript.


02-09-2004, 02:42 PM
Since it is Intranet, I assume you do not really care about non-graphical browsers. In this case something like this should do:

1. On you web page designate a block element where the text will be shown when a link is clicked. Within this block element define block elements with the text and give each a unique id:

<div id="popupTextHolder">
<p id="popupText1">lalalalal</p>
<p id="popupText2">lalalalal</p>

2. Make all your popup text hidden by adding the following to your CSS declaration:
#popupTextHolder p
{ display: none;

3. In your javascript code define a function which will show popup:
function showPopUp(popupID)
{ popupTextHolder = document.getElementById('popupTextHolder');
popupTextHolder.currentPopUp.style.display = 'none';
popupTextHolder.currentPopUp = document.getElementById(popupID);
popupTextHolder.currentPopUp.style.display = 'block';
return false;

4. Add onclick event to your links:
<a href="#" onclick = "return showPopUp('popupText1')">Link 1</a>
<a href="#" onclick = "return showPopUp('popupText2')">Link 2</a>

02-09-2004, 04:14 PM
Hi Vladdy:

Thanks a lot for that. But I haven't had any joy. I've done as you said but as I don't have a style sheet linked to the documents I just used a <style> tag. I'm not sure if this is ok. Also, I can see the block and the text within the block in normal editing view in FrontPage, I then created the links to call the function but oh dear nothing happens when I preview an click the link...

02-09-2004, 04:48 PM
If you want to be successful with your web development start with the following:

Go to Start -> Settings -> Control Panel
Click on the "Add/Remove Software"
Find the "MS FrontPage" in the list
Click "Uninstall"

Now that you have that POS tool out of the way, you can start talking intelligently why something works and something does not.
Here is the demo page I quickly thrown together for you:

02-09-2004, 04:57 PM
My God!!. You're so right, but the company I work for don't let me use anything else. I have done my own site in Flash and Dreamweaver, if you want to have a look www.room313.co.uk

Besides, I don't have any formal training in web developing, they just threw me in the project because I knew a bit about the subject. Thanks a lot again for your help. I'll take good note of this.

02-09-2004, 04:57 PM
In the original post I made a mistake of naming the variable the same as the textual ID of the variable, which screws things up in the damn IE. See the link I posted for the corrected code (tested in Gecko and IE 6.0)