Closed Bug 274186 Opened 20 years ago Closed 20 years ago

BUTTON IMAGE WITHOUT JAVASCRIPT WIDTH PROPRIETY

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: degregorio.soft, Assigned: bugzilla)

Details

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"
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>
--> 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
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.