Jump to content
  • 0

Anchor Tags in tabbed HTML data page


Heineperson

Question

Hello,

I have created a tabbed HTML data page with 5 channels. In one channel, I have a wordpress page with many data pages embedded. I would like to use anchor tags so that when the user submits a form or updates a table - they are redirected to the same part of the page (which is within the tabbed HTML iframe). In the past, I have addressed the problem by adding the following code to the header of data pages embedded in weebly or wordpress pages: 

<script>
window.location.href ="#AnchorTag";
</script>

However, this method does not seem to work in the case (I suspect because the page is inside of an iframe?). Do you have any suggestions on how I might fix this problem?

Thanks,

Katie

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I guess the reason it is not working because the anchor  is hardcoded. The proper way use anchor with iframe is to incorporate the frame.

Here's an example:

Use this in HTML Block:
<a href="#" onclick="iframeRedirect()">Click Here</a>
<iframe id="myiframe" src=""></iframe>

 

Place this in footer:

<script>
    function iframeRedirect(event)
    {
        var iframe = document.getElementById('myiframe');
        iframe.src = "http://something.com/blog.php#anchor";
    }
</script> 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...