469,271 Members | 1,466 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

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 10567
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by Desmond Liu | last post: by
54 posts views Thread by Sander | last post: by
3 posts views Thread by Paul Lautman | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.