473,388 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Style is null or not an object

I'm getting the following error:

brian.style is null or not an object on the following code...can anyone
help?

<html>
<head>
<script>
<!--
function brianIt(){
brian.style.height = 12;
}
//--></script>
</head>
<body>This website is currently under construction.
<iframe id="brian" width="105" src="index.asp">iFrame it</iframe>
</body>
</html>

Thanks

Aug 29 '05 #1
3 10713
bd*********@gmail.com said the following on 8/29/2005 4:16 PM:
I'm getting the following error:

brian.style is null or not an object on the following code...can anyone
help?
The iframe does not have a style attribute so IE won't read it unless
you explicitly set it.
No DTD. Give it one.
<html>
<head>
<script>
<script type="text/javascript">
<!--
Script hiding is obsolete and can actually cause problems in some DTD's
function brianIt(){
brian.style.height = 12;
http://jibbering.com/faq/#FAQ4_41

document.frames['brian'].style.height = "12px";

The unit is required.
}
//-->
Script hiding is obsolete and can actually cause problems in some DTD's

</script> </head>
<body>This website is currently under construction.
<iframe id="brian" width="105" src="index.asp">iFrame it</iframe>


<iframe name="brian" style="width:105px;height:10px"
src="index.asp">iFrame it</iframe>

Beginning with valid HTML will go a long way in solving "problems".

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Aug 29 '05 #2
Lee
bd*********@gmail.com said:

I'm getting the following error:

brian.style is null or not an object on the following code...can anyone
help?

<html>
<head>
<script>
<!--
function brianIt(){
brian.style.height = 12;
}
//--></script>
</head>
<body>This website is currently under construction.
<iframe id="brian" width="105" src="index.asp">iFrame it</iframe>
</body>
</html>


I don't believe you. That code should not show any error.
You're not even calling the function.
Please don't post make-believe code and ask for help with it.

You don't need the comments around the code. They're obsolete.
You can't refere to an object by it's id name, use the
getElementById() method:
<html>
<head>
<script>
function brianIt(){
document.getElementById("brian").style.height = 12;
}
</script>
</head>
<body onload="brianIt()">
This website is currently under construction.
<iframe id="brian" width="105" src="index.asp">iFrame it</iframe>
</body>
</html>

Aug 29 '05 #3
Lis
some say, the biggest bussines is where u fool and get
foold... i say...

i frames got no closing tags.
do you have to set the style var directly to the iframe tag?
so html is doing an object for style thats passed to
javascript.
the other way ist to speak directly to height without style.
correct?
On 29 Aug 2005 13:16:04 -0700, bd*********@gmail.com wrote: I'm getting the following error:

brian.style is null or not an object on the following code...can anyone
help?

<html>
<head>
<script>
<!--
function brianIt(){
brian.style.height = 12;
}
//--></script>
</head>
<body>This website is currently under construction.
<iframe id="brian" width="105" src="index.asp">iFrame it</iframe>
</body>
</html>

Thanks


Aug 29 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Desmond Liu | last post by:
I've read articles like Scott Meyer's EC++ (Item 22) that advocate the use of references when passing parameters. I understand the reasoning behind using references--you avoid the cost of creating...
1
by: Tristan Miller | last post by:
Greetings. I am trying to write a function which toggles the display of a certain class of <div> elements in an HTML page. The CSS file initially sets some classes to "display: none", and...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
54
by: Sander | last post by:
1. I was having a discussion with somebody and I think it's just religious. We are developing some software and he was looking through my code. I use if (pointer) to test a pointer for NULL. He...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
4
by: jarek | last post by:
Hi, this is my code: CSSStyleDeclaration.prototype.__defineSetter__('display', displaySetter); function displaySetter(value) { var parent = findParent(document, this); if (parent) {
3
by: Paul Lautman | last post by:
If I have the following: <style type="text/css"> ..nd { display : none; } </style> <input type="checkbox" id="b1" class="nd"/> how do I tell (in javascript) that the checkbox's display...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.