/    Sign up×
Community /Pin to ProfileBookmark

Function to navigate to a web page and target to a frame

hi

using this code in the body of the page:

[code]
<a href=”#” onclick=”getpage();”>First</a>

[/code]

what would the code for

function getpage()

be in the header of the web page, if i wanted it to navigate to a web page and have that page flow into an iframe on the page named ‘data’?

many thanks

tx

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyFeb 25.2007 — So your on page A, once they click the link to page C you want them to go to page B and show page C in an iframe on page B?
Copy linkTweet thisAlerts:
@tx12345authorFeb 25.2007 — thanks for the reply

i have a page that has a body with a link to click on with two iframes underneath. the link refers to a htm doc in the same folder as the web page

[code=html]
<html>
<head>
<script>
function getpage()
{

}
</script>

</head>
<body>

<a href="#" onclick="getpage();">First</a>
<br><br>
<table>
<tr><td>
<iframe ID="f1" src="test.htm">

<td>
<iframe ID="f2" src="test2.htm">

</table>
</body>
</html>

[/code]



when 'First' is clicked i want the second frame to load with a new page.

did that answer your question?

tx
Copy linkTweet thisAlerts:
@bathurst_guyFeb 25.2007 — Why do you have to do this with JavaScript, why not the HTML target attribute?
Copy linkTweet thisAlerts:
@tx12345authorFeb 25.2007 — ah, i wish i did not have to do it at all!

the purpose is to simulate an existing issue to find a way to get the source from one of the frames. i need a workng example. you ask a great question, and i'd love to hear the answer from the person who designed the web page i have been monkeying around with for the last 30 hours ?

so getting back to my earlier question, is there a way to target a frame with new content using a java function? or is there a way to have a few frames on the web page that are hidden, and then have the java function highlight one over the others? that is a little closer to the example i am working with i think.


for example:

[code=html]

<html>
<head>
<script>
function getpage()
{
//code to hide, let's say, iframe f2 and then show f3

}
</script>
</head>
<body>
<a href="#" onclick="getpage();">First</a> <br><br>
<table>
<tr><td>
<iframe ID="f1" src="test.htm"> <td>
<iframe ID="f2" src="test2.htm">
<iframe ID="f3" src="test3.htm">
<iframe ID="f4" src="test4.htm">

</table>
</body>
</html>
[/code]


thanks for the reply

tx
×

Success!

Help @tx12345 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...