dcsimg
www.webdeveloper.com
Results 1 to 11 of 11

Thread: Can an anchor tag work from a button on a page to a page within an iFrame?

  1. #1
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    73

    Can an anchor tag work from a button on a page to a page within an iFrame?

    Hi,

    I'd love to know how to get a button with an anchor tag such as "#example" to link to this:

    HTML Code:
    <a name="example"></a>
    which is on a page within an iFrame.

    Is it something like this: "newcustText.htm#example" I tried that and instead it opened the iFrame page as a full screen and not within the iFrame. I hope I'm making sense.

    Any help will be greatly appreciated.

    Blastbum
    Last edited by blastbum; 09-27-2005 at 10:03 PM.

  2. #2
    Join Date
    Sep 2005
    Posts
    30
    did you target the iframe?

    <a href="iframe.htm" target="_self"></a>

    i know you have to do that with normal links.. i guess the same thing would apply to anchors

  3. #3
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    73
    Hi Kamui,

    Not sure what you mean by that. This is the code (on a button) on the "parent" page, which is called "newCust.htm":
    HTML Code:
    <a href="#example"</a>
    And this is the code I've got on the page that is within the iFrame, which is called "newcustText.htm":
    HTML Code:
    <a name="example"></a>
    Any idea as to how to get the anchors to work?

    Your help will be tremendously appreciated.

    Blastbum

  4. #4
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    73
    Any ideas anybody? I urgently need a breakthrough with this.

  5. #5
    Join Date
    Jun 2005
    Location
    Denmark
    Posts
    135
    the only way to do this is by placing a"<A name....>next to the button

  6. #6
    Join Date
    Aug 2005
    Location
    The Hill Ch' Hill
    Posts
    381

    Red face

    Modify your code above to get

    HTML Code:
    <a href="#example" target="frameName">click me</a>
    notice that I have added an attribute called target whose value is supposed to take the name of the frame/iframe that you want to link to.

    Using the code I have said above, you must also add the following onto you iframe statement:
    HTML Code:
    <iframe name="frameName" src="..............">

  7. #7
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    73
    I GREATLY appreciate your help tabzter!!

    I've changed the code to how you've suggested:

    HTML Code:
                    <td width="615" valign="top" bgcolor="FFD600"><img src="img/delivLft.jpg" width="123" height="3" align="top"><a href="#schedule" target="custText" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('deliveries','','img/deliveries2.jpg',1)"><img src="img/deliveries1.jpg" name="deliveries" width="110" height="24" border="0"></a><a href="#cost" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('cost','','img/cost2.jpg',1)"><img src="img/cost1.jpg" name="cost" width="75" height="24" border="0"></a><a href="#services" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('services','','img/services2.jpg',1)"><img src="img/services1.jpg" name="services" width="75" height="24" border="0"></a><a href="nonflash.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','img/home2.jpg',1)"><img src="img/home1.jpg" name="home" width="109" height="24" border="0"></a><img src="img/homeRgt.jpg" width="123" height="3" align="top"></td>
                    <td width="66" valign="top" bgcolor="BD2925"><!--DWLayoutEmptyCell-->&nbsp;</td>
                  </TR>
                  <TR> 
                    <td height="256" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="BD2925">
                        <!--DWLayoutTable-->
                        <tr> 
                          <td width="65" height="146"></td>
                          <td width="615" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="FFD600">
                              <!--DWLayoutTable-->
                              <tr> 
                                <td width="10" height="3"></td>
                                <td width="594"></td>
                                <td width="10"></td>
                              </tr>
                              <tr> 
                                <td height="243"></td>
                                <td rowspan="2" valign="top"><iframe name="custText" src="newcustText.htm" width="595" height="246" frameborder="0"></iframe></td>
    I then tested it and instead of opening "newcustText.htm" it opened "newCust.htm" which is suppose to be the parent page. I think that's got something to do with the targeting.

    What do you think the issue is?

    Blastbum

  8. #8
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    73
    To see what I mean, click here. Then click on the "Deliveries" button.

    Any ideas?

    Your help is appreciated.

    Blastbum

  9. #9
    Join Date
    Aug 2005
    Location
    The Hill Ch' Hill
    Posts
    381
    change

    <a href="#example" target="frameName">click me</a>

    to

    <a href="newcustText.htm#example" target="frameName">click me</a>

  10. #10
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    73
    Worked like a charm!!

    LOVE YOUR WORK TABZTER!!!!

  11. #11
    Join Date
    Aug 2005
    Location
    The Hill Ch' Hill
    Posts
    381
    No Probs and May I say thats a nice lookin site. Keep up the good work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles