/    Sign up×
Community /Pin to ProfileBookmark

javascript and frames

Hi,
I have a page named frame .html that defines 2 frames namely upperframe and lowerframe. The code is as follows,

<html>

<frameset rows=”10%,*” frameborder=”1″>
<frame name=”upperframe” src=”left.htm”>
<frame name=”lowerframe” src=”right.htm”>
</frameset>

</html>

The code for left.html is as follows
<html>
<body bgcolor=”#EBC79E”>
<h3>Frame B</h3>
</body>
</html>

The code for right.html is as follows
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<script type=”text/javascript”>
function changeurl()
{
parent.upperframe.location.href=”demo.htm”
parent.lowerframe.location.href=”right.htm”
}
</script>
</head>
<body>
<form>
<input type=”button” onclick=”changeurl()” value=”Change url” >
</form>
</body>
</html>

The code for demo.html is as follows,
<html>
<body bgcolor=”red”>
<h3>Frame a</h3>
</body>
</html>

When the Change url button is clicked I want the demo.html to be loaded in the upperframe and want the lowerframe to remain as it is. But somehow this does not seem to work. Please help.

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@CrazyFeb 29.2004 — You're going to kick yourself here. Simply change your opening script tag in the right.htm page from:

<script type="text/javascript">

to:

<script Language="Javascript">

That will solve the problem for you. In addition you don't need the second line of code:

parent.lowerframe.location.href="right.htm"

That page won't change, so you don't need to reload it.
Copy linkTweet thisAlerts:
@PittimannFeb 29.2004 — Hi!

Originally posted by crazy:

Simply change your opening script tag in the right.htm page from:

<script type="text/javascript">

to:

<script Language="Javascript">[/QUOTE]
It is ok, to use language in the script tag together with type. Just using one of them, it should be type and NOT language.

Btw., sprak - I don't see a reason, why your code shouldn't work. Well you should have all necessary tags in each document but even though some are missing, the stuff you posted should work.Originally posted by crazy:

In addition you don't need the second line of code:[/QUOTE]
That's absolutely right!

Cheers - Pit
Copy linkTweet thisAlerts:
@CrazyFeb 29.2004 — Originally posted by Pittimann:

It is ok, to use language in the script tag together with type. Just using one of them, it should be type and NOT language. [/QUOTE]


Look, if you use Type the script doesn't work, if you use Language the script does work, if you don't believe me try it. Whether you think it's right or wrong is irrelevant as the script won't work with Type, it only works with Language.

Before you shoot down someone else's post, acting the know it all, why don't you just try it first. It's people like you that put people off responding to help others.
Copy linkTweet thisAlerts:
@PittimannFeb 29.2004 — Hi Crazy!

I didn't want to shoot you down!if you don't believe me try it.[/QUOTE]Actually, there is no need to try it! Nevertheless - believe me or not - I saved the snippets, which sprak posted as individual files (with type in the script tag!) and everything worked. Besides that, nowaday's standard requires the type attribute, but not the language attribute. It is recommended to use language as well to avoid problems with older browsers.It's people like you that put people off responding to help others.[/QUOTE]If it puts you off responding to help others when somebody corrects a mistake - well - I can't help it.

I did not at all want to offend or discourage you. What you posted was partly wrong and I just corrected that.

Cheers - Pit

Edit: if you like, have a look at this to learn about the attributes of the script tag:

http://www.w3.org/TR/REC-html40/interact/scripts.html#edef-SCRIPT
Copy linkTweet thisAlerts:
@CrazyFeb 29.2004 — I made no mistake - the mistake was all yours. In future test people's code before acting the know it all. You were wrong, so now just deal with it. I have no intention of continuing this argument with you; hobbyists are always the same - nothing but a pain in the arse. I have nothing more to say to you.
Copy linkTweet thisAlerts:
@PittimannFeb 29.2004 — Hi!

I was born an asshole and I didn't change since then ?

Cheers - Pit
Copy linkTweet thisAlerts:
@sprakauthorFeb 29.2004 — Hi Pittimann and Crazy,

Thanks for helping me with my code.

Pittmann, you were right. There was nothing wrong with the code. But somehow, I later got it working. May be there was some problem with the browser. It was not refreshing the page. But now without making any changes it works fine.

Thanks to both of you for giving me suggestions ?
Copy linkTweet thisAlerts:
@PittimannFeb 29.2004 — Hi!

You're welcome! Sorry, your thread went into that direction...

Cheers - Pit
×

Success!

Help @sprak 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.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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