473,397 Members | 2,056 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,397 software developers and data experts.

Problems dnyamically rewriting a div height

I'm losing my mind over this one, so figured I would ask. I'm trying
to rewrite the height of a div to make it fit within an area of the
browser window. It works great in FireFox (no error/etc messages at
all). But in IE I receive an error. Here is the Javascript code I'm
trying to run:

<script type="text/javascript">
<!--
function equalize() {
var e = document.getElementById("left_column");
var newheight = window.innerHeight - 60;
e.style.height = newheight + 'px';
}
window.onresize=equalize;
//-->
</script>

I've tried changing my doctype header and all sorts of things (some of
my research led me to believe that might be my problem). The error I'm
receiving is:

Line: 261
Char: 2
Error: Invalid Argument
Code: 0

Line 261 is the line "e.style.height = newheight + 'px';"

I can't figure it out for the life of me. Any help would be GREATLY
appreciated. Thanks in advance.

Nov 9 '05 #1
2 2809
mw*******@gmail.com wrote:
I'm losing my mind over this one, so figured I would ask. I'm trying
to rewrite the height of a div to make it fit within an area of the
browser window. It works great in FireFox (no error/etc messages at
all). But in IE I receive an error. Here is the Javascript code I'm
trying to run:

<script type="text/javascript">
<!--
HTML comment delimiters should not be used inside script elements.

function equalize() {
var e = document.getElementById("left_column");
var newheight = window.innerHeight - 60;
IE does not support innerHeight. Feature test and use an appropriate
property:

<URL:http://www.quirksmode.org/viewport/compatibility.html>

Inspect the first script in the page titled 'Inner width'.

e.style.height = newheight + 'px';
}
window.onresize=equalize;
//-->
</script>


[...]

--
Rob
Nov 9 '05 #2
JRS: In article <11**********************@g47g2000cwa.googlegroups .com>
, dated Wed, 9 Nov 2005 12:27:49, seen in news:comp.lang.javascript,
mw*******@gmail.com posted :
I'm losing my mind over this one, so figured I would ask. I'm trying function equalize() {
var e = document.getElementById("left_column");
var newheight = window.innerHeight - 60;
e.style.height = newheight + 'px';
} Line: 261
Char: 2
Error: Invalid Argument
Code: 0

Line 261 is the line "e.style.height = newheight + 'px';"


Evidently it does not like line 261 or thereabouts. If there is an
error in line 261, either it is before the = or after it or the RHS is
incompatible with the LHS.

So try first e.style.height = '200px'; for which I expect success.
If it fails, try alert(e.style.height) to see if that exists.

Don't just re-type those identifiers; use copy'n'paste in case you have
a typo invisible in your font.

So try temp = newheight + 'px';
alert(Temp)
e.style.height = Temp;
and see what Temp really is.
If necessary, use also alert(newheight); .

If you get a non-obvious execution error on a line, then believe NONE of
your assumptions about the existence or value of anything on the line.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 10 '05 #3

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

Similar topics

13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
0
by: Linda Antonsson | last post by:
Hi, I am trying to put together a CSS-based layout consisting of a header, a sidebar and a main content area. Page: http://www.westeros.org/ASoWS/ CSS:...
3
by: eternalD3 | last post by:
Hi, I have a problem to get this working on Opera 7.x+. This does not need to work on older Opera browsers There are problems on rendering the sub-level navigation. It aligns right on Firefox...
6
by: Jon Maz | last post by:
Hi All, I am experimenting with URL Rewriting using the techniques outlined by Scott Mitchell in his article "URL Rewriting in ASP.NET"...
1
by: laszlo | last post by:
The function below (as fc.js) works with IE6.0, NS4.2 NS7.1. It rewrites itself increasing the number. However if I comment out the othervise unnecessary window.alert, it still works with NS but...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
13
by: Ikke | last post by:
Hi everybody, I've downloaded a design from www.oswd.org and have started rewriting the css and html to end up with a new design for my site. So far so good, but there are a few problems I...
409
by: jacob navia | last post by:
I am trying to compile as much code in 64 bit mode as possible to test the 64 bit version of lcc-win. The problem appears now that size_t is now 64 bits. Fine. It has to be since there are...
0
by: Hamayun Khan | last post by:
Hi I m developing site for my client using asp.net 2.0. He asked me for URL rewriting. which I have done using Intelligencia.UrlRewriter.RewriterHttpModule rewriting module. I write the...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.