Hello,
I am looking for a cross browser way (IE, Firefox, Safari) of
getting the screen width, in pixels, of an element on my page. I am
interested in the "navImg" table cell. Here is a snippet of code:
<tr>
<td style="width:45 px; height:38px;" id="navImg" name="navImg">< img
src="images/NAV_07.gif" alt="" border="0"></td>
How would I use JS to get this width? (I can't just use 45 as a
hard-coded value, because I may be going in and changing this table
cell).
Thanks, - Dave 2 1563 la***********@z ipmail.com wrote: Hello, I am looking for a cross browser way (IE, Firefox, Safari) of getting the screen width, in pixels, of an element on my page. I am interested in the "navImg" table cell. Here is a snippet of code:
<tr>
<td style="width:45 px; height:38px;" id="navImg" name="navImg">< img src="images/NAV_07.gif" alt="" border="0"></td>
How would I use JS to get this width? (I can't just use 45 as a hard-coded value, because I may be going in and changing this table cell).
Thanks, - Dave
In regard to cross-browser-nes, usefull stuff is located here:
<URL:http://www.quirksmode. org/viewport/compatibility.h tml>
--
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: delerious |
last post by:
I need to determine an element's width and height in pixels (not including
padding, border, and margin) in Javascript. The element will not have width
or height styles specified.
In Mozilla, I know I can use document.defaultView.getComputedStyle() to do
this.
IE does not support document.defaultView.getComputedStyle(). It supports
offsetWidth/offsetHeight, but those include the padding and border. IE also
supports...
|
by: Kai Grossjohann |
last post by:
I would like to put a text input field (in the sense of <input
type="text">) and an image next to each other, where I know the size
in pixels of the image, and I know the total width in em. I haven't
found a way to do this.
I tried
<span style="width:20em">
<input type="text">
<img width="25px" src="...">
|
by: BiNZGi |
last post by:
Hi
I have reduced the problem to this code:
<form>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><input type="text" style="width: 100%;" value="Lorem ipsum
dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat
|
by: puzzled |
last post by:
Okay, so my subject sounds a bit crass. As much as I'd like to
totally embrace css and avoid "deprecated" usage, sometimes the
deprecated stuff is so much easier and more effective. Plus, it at
least does what I want it to, while I'm left puzzled trying to make a
css implementation do the same thing.
Here is a simple example.
I want to have four identical-sized images displayed in a two-by-two
arrangement, wtih room for a centered...
|
by: Thomas Mlynarczyk |
last post by:
Hi!
I have noticed something strange: I have an element styled to have padding,
a border and some margin. The element contains preformatted text. When the
browser window is made narrow enough, a horizontal scrollbar appears as the
preformatted text becomes too wide and is not wrapped. So far so good. But
why is the element itself shrunk to fit in the window (still having its full
margin, padding and border visible) as if it's content was...
| |
by: R0bert Nev1lle |
last post by:
Internet Explorer always presents me with a challenge (partial
repost). The current issue involves emulating max-width in IE using
the technique described by Svend Tofte.
http://www.svendtofte.com/code/max_width_in_ie/
The CSS code uses JavaScript expressions and feeds the browser's width
to the style. The CSS code follows.
* html #Content {
|
by: mike eli |
last post by:
Hi,
I have several absolute positioned elements inside an absolute
positioned DIV.
I would like one of the nested elements to have a dynamic width. I set
it's left and right attributes to 5, so the the element should have a
width = parentWidth - 10; This is the desired behaviour, but it won't
work. I still have to specify a width or the element has a width of 0.
Setting the width to '100%' doesn't give me the desired effect; it
takes...
|
by: RickH |
last post by:
Hello,
I would like to create a user XSD data type that inherits from the w3
standard data type called ID to make sure a certain repeated element
always contains distinct values. The problem is I would like this
element to also allow spaces to be present. By default the ID data
type does not allow spaces.
How can I inherit ID and also allow the entry of spaces in the data of
a new derived data type? This is a title column where I...
|
by: Summercool |
last post by:
wow... i didn't know that, for
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<span style="width: 100px; background: yellow">a</span>b
<div style="width: 100px; background: yellow">a</div>b
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |