BUTTON IMAGE WITHOUT JAVASCRIPT WIDTH PROPRIETY

RESOLVED INVALID

Status

()

--
major
RESOLVED INVALID
14 years ago
14 years ago

People

(Reporter: degregorio.soft, Assigned: bugzilla)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

With the follow code in EVERY BROWSER the BannerWidth input text show the
correct width of the banner ('600'),with firefox or mozilla the result is
"undefined" !

Try :

<input type='image'  name='banner'
src='https://bugzilla.mozilla.org/mozilla-banner.gif' width="600">
<input type='text' readonly name='BannerWidth' value='' size='3'>
<script
type="text/javascript">document.all.BannerWidth.value=document.all.banner.width;</script>

Reproducible: Always
Steps to Reproduce:
Try this:

<input type='image'  name='banner'
src='https://bugzilla.mozilla.org/mozilla-banner.gif' width="600">
<input type='text' readonly name='BannerWidth' value='' size='3'>
<script
type="text/javascript">document.all.BannerWidth.value=document.all.banner.width;</script>

Actual Results:  
The BannerWidth text show "undefined"

Expected Results:  
In everybrowser BannerWidth show "600"

Comment 1

14 years ago
You're using an incorrect way to access an attribute for your element. Correct
way would be:

<input type='image'  id='banner'
src='https://bugzilla.mozilla.org/mozilla-banner.gif' width='600'>
<input type='text' readonly id='BannerWidth' value='' size='3'>

<script type="text/javascript">
document.getElementById('BannerWidth').setAttribute('value',document.getElementById('banner').getAttribute('width'));
</script>

Comment 2

14 years ago
--> INVALID

The code given Paul van Schayck should work in all browsers, including Mozilla,
Firefox and other browsers based on the same code.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.