Style is null or not an object

B

bdogsputnik

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
 
L

Lee

(e-mail address removed) 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>
 
R

Randy Webb

(e-mail address removed) 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 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

</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".
 
L

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top