Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    MLD
    MLD is offline
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Loading text to page

    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,


    www.room313.co.uk

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Where is this text stored in the first place? Can it be part of the page itself?
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #3
    MLD
    MLD is offline
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Thanks

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>
    ....
    </div>

    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');
    if(popupTextHolder.currentPopUp)
    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>
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #5
    MLD
    MLD is offline
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:
    www.vladdy.net/Demos/onClickText.html
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #7
    MLD
    MLD is offline
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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)
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •