Results 1 to 5 of 5

Thread: Help with hyperlink

  1. #1
    Join Date
    Nov 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with hyperlink

    Well, how can I place a link in the page1.html that opens page3.html in a frame placed in page2.html?

  2. #2
    Join Date
    Sep 2004
    Location
    UK
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you're using a frameset with page1 and page2, just use:
    <a href="page3.html" target="[frame name]">(Link name)</a>
    in page1, replacing [frame name] with the name of the frame page2 is in.

  3. #3
    Join Date
    Nov 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thats not what i want Odin. What I need is an hyperlink in page1, clicking it opens page2 which have a frame and inside this frame apears page3. Do you understand?
    Visit www.go2battle.com to see it, the links of the news in the main page don't open the new, open the page2 with the specified initial frame. What i want is a paramater that tells page2 which page must show in the frame.

  4. #4
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Simple enough isn't it heimdall?

    Make a hyperlink to a frame page...
    Do you have FrontPage?

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  5. #5
    Join Date
    Sep 2004
    Location
    UK
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Right, I think I know what you mean. I can't think of an easy way to do it, or any easy way to pass the parameter, other than using the query string. This would be very easy in PHP, but in case you can't use it, try using this script in page2 to write the iframe or frameset.

    Code:
    Iframe:
    <script type="text/javascript">
    var url = String(window.location);
    var match = url.match(/[?&]article=([^&#?]*)/)
    var article = match[1]
    document.write('<iframe name="article" src="'+article+'.html" height="400" width="400"></iframe>')
    </script>
    
    Frameset:
    <script type="text/javascript">
    var url = String(window.location);
    var match = url.match(/[?&]article=([^&#?]*)/)
    var article = match[1]
    document.write('<frameset rows="100,*" name="news_frame"><frame name="news" src="article_header.html"><frame name="article" src="'+article+'.html"></frameset>')
    </script>
    Obviously, seen as the script writes the iframe/frameset itself, you'll need to change it to what you want to use.

    Then on page1 you can use, taking it from go2battle:
    <input type="button" onClick="window.open('page2.html?article=page3','News','width=400,height=400,scrollbars=yes,left=1,top=1')">

    Or convert the link to text:
    <a href="#" onClick="window.open('page2.html?article=page3','News','width=400,height=400,scrollbars=yes,left=1,top=1')">Link</a>

    Replace page3 in your links with the page you want to load inside page2 (note that '.html' is automatically appended to the end).

    Edit: Missed an ending tag
    Last edited by Odin; 11-09-2004 at 09:39 PM.

Bookmarks

Posting Permissions

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