Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 15th, 2004, 04:45 AM
jet jet is offline
Registered User
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default onload changing class in other frame


I have 2 frames, framemain and frameright.
Clicking on the link <a href="lap003.htm" target="framemain"><span id="p003" name="p003" class="looknormal">&nbsp;3</span></a> in main changes the content of frameright.
Onload of the new right page I want to change the style of 'p003' in main page.

I can do it this way:
<body onload="javascript:parent.document.getElementById( 'p003').style.background='url(arrowon.gif)';javasc ript:parent.document.getElementById('p003').style. fontWeight='bold';javascript:parent.document.getEl ementById('p003').style.color='white';">

and there I used also the onunload="" to reverse the style. It works, but it means a lot of code having over 100 pages.

Change classes form "looknormal" to "looknew" during onLoad would be better, but I didn't succes.

Can someone help me with this?
thanks, Jet

Old October 15th, 2004, 05:32 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

parent.document.getElementById('p003').className = "looknew";

Old October 15th, 2004, 09:57 AM
jet jet is offline
Registered User
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks Joe,

My first reaction: I tried this before and it didn't work even after checking the syntax over and over. But nevertheless I tried again, more confident about this part of the code now, and gggrrrrr, it was something else that let the onload faile before.

thanks for making me try again :-)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Onload frame is refreshed and page is not found taraprasad Pro JSP 1 January 14th, 2008 04:59 AM
parsing form data from frame to other frame audio-catalyst Classic ASP Basics 5 January 3rd, 2006 02:57 PM
Call right frame Page_Load event from left frame. ochanarachel Classic ASP Basics 0 January 28th, 2005 05:13 AM
Changing Control Property from another Frame Wandha ASP.NET 1.0 and 1.1 Basics 4 August 8th, 2003 01:34 AM
Changing Control Property from another Frame Wandha Forum and Wrox.com Feedback 1 August 5th, 2003 07:43 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.