Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
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 January 14th, 2005, 06:03 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default Why getElementById("f2").style

When i used parent.document.f2.style.visibility it's not working
on other hand parent.document.getElementById("f2").style.visibil ity is working properly.Where I am wrong??
Since i want to use visibility by using "name" not by "id"
Any ideas?
**********MainPage.html *******
 <body>
<table bgcolor=red>
<tr><td>
<iframe name="f1" id="f1" src="first.html"></td>
</tr>
<tr><td>
<iframe name="f2" id="f2" src="second.html" style="visibility:none"></td>
</tr>

<tr><td>
<iframe name="f3" id="f3" src="third.html"></td>
</tr>
</body>

**************first.html*****
<script>
function hello(val)
{
var obj;
if(val==2)
 { parent.document.getElementById("f2").style.visibil ity = "hidden";
 }
if(val==3)
 { parent.document.getElementById("f3").style.visibil ity = "hidden";
 }

}
</script>
<input type=button value="frame2" onclick="hello('2')">
<input type=button value="frame3" onclick="hello('3')">
**********************

Cheers :)

vinod
__________________
Cheers :)

vinod
 
Old January 14th, 2005, 11:48 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I'm not sure why you are bothered, getElementById is a standard method whereas others may not work in some browsers, but try:
Code:
parent.f2.style.visibility

--

Joe (Microsoft MVP - XML)
 
Old January 18th, 2005, 11:00 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Joe

parent.f2.style.visibility is not working with my browser.

Offcourse, document.getElementById is the best choice.

I was wondering for that something i am missing .
Thanks Again

Cheers :)

vinod




Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i assign keypress event on F2 kau_shuk VS.NET 2002/2003 1 August 25th, 2006 08:49 PM
DataGet with VS 2003 + .NET F2.0 victor888 C# 2005 2 March 13th, 2006 02:30 PM
Using getElementById Frank Huddleston XML 4 November 11th, 2005 01:44 PM
'getElementById()' anshul Javascript How-To 1 September 1st, 2004 03:57 PM
difference between style.visibility and style.disp Mimi Javascript How-To 6 September 17th, 2003 11:50 PM





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