By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Style is null or not an object

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.