473,662 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Safari innerHTML not getting form values

KK
Please help!

I am currently experiencing a bug in Safari v125.9.
When I modify the value of form input box and then get the innerHTML
property of the surrounding div object - I am returned the original
form value not the changed value!

Has anyone else encountered this?

Cheers.
Jul 23 '05 #1
7 3471
KK wrote:
Please help!

I am currently experiencing a bug in Safari v125.9.
When I modify the value of form input box and then get the innerHTML
property of the surrounding div object - I am returned the original
form value not the changed value!


Thats correct behavior. You are changing the form elements value, not
the innerHTML of the form element itself.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
On Sun, 05 Dec 2004 20:02:26 -0500, Randy Webb
<Hi************ @aol.com> wrote:
KK wrote:
Please help!

I am currently experiencing a bug in Safari v125.9.
When I modify the value of form input box and then get the innerHTML
property of the surrounding div object - I am returned the original
form value not the changed value!


Thats correct behavior. You are changing the form elements value, not
the innerHTML of the form element itself.


Well there's no specification for innerHTML other than at best the
behaviour of IE, but I would say it should be the serialisation of the
current DOM, in which case it should return the current, not the
original value.

Jim.
Jul 23 '05 #3
Jim Ley wrote:
On Sun, 05 Dec 2004 20:02:26 -0500, Randy Webb
<Hi************ @aol.com> wrote:

KK wrote:

Please help!

I am currently experiencing a bug in Safari v125.9.
When I modify the value of form input box and then get the innerHTML
property of the surrounding div object - I am returned the original
form value not the changed value!


Thats correct behavior. You are changing the form elements value, not
the innerHTML of the form element itself.

Well there's no specification for innerHTML other than at best the
behaviour of IE, but I would say it should be the serialisation of the
current DOM, in which case it should return the current, not the
original value.


I should have tested this in IE first, but IE seems to be the only one
that actually gives the serialized HTML code.

<div id="myDiv">
<form name="myForm">
<input type="text" value="original value" name="myInput">
<input type="button"
onclick="docume nt.myForm.myInp ut.value='new value';"
value="Change the Value">
<input type="button"
onclick="alert( document.getEle mentById('myDiv ').innerHTML)"
value="Show the HTML">
</form>
</div>

For simplicity sake, I am only posting the relevant parts of the
innerHTML properties.

IE6 SP2 XP:
Alert prior to changing: value="original value";
Alert after changing: value="new value";

Opera 7.54:
Alert prior to changing: value="original value";
Alert after changing: value="original value";

Mozilla 1.7.1:
Alert prior to changing: value="original value";
Alert after changing: value="original value";

Netscape 7.2:
Alert prior to changing: value="original value";
Alert after changing: value="original value";


--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
KK wrote:
Please help!

I am currently experiencing a bug in Safari v125.9.
When I modify the value of form input box and then get the innerHTML
property of the surrounding div object - I am returned the original
form value not the changed value!

Has anyone else encountered this?

Cheers.


For the record, both Firefox and Netscape have the same behaviour; only
IE seems to update the innerHTML. Given that, in this case, IE is the
"standard", then they all share the same "bug".

I think Jim has the right idea, if for no other reason than if IE is
the standard, then the others should at least do what IE does.

Of course there are work arounds, post again if you have a specific
issue.

Have a good one.

--
Rob
Jul 23 '05 #5
RobG wrote:
KK wrote:
Please help!

I am currently experiencing a bug in Safari v125.9.
When I modify the value of form input box and then get the innerHTML
property of the surrounding div object - I am returned the original
form value not the changed value!

Has anyone else encountered this?
Cheers.

For the record, both Firefox and Netscape have the same behaviour; only
IE seems to update the innerHTML. Given that, in this case, IE is the
"standard", then they all share the same "bug".


IE is not the "standard". Far from it.
I think Jim has the right idea, if for no other reason than if IE is
the standard, then the others should at least do what IE does.


Thats a dangerous statement to make. IE does this:

idOfElement.inn erHTML;

but no other browser does. Does that mean they all have a bug? No.


--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #6
On Mon, 06 Dec 2004 01:19:16 GMT, Jim Ley <ji*@jibbering. com> wrote:

[snip]
Well there's no specification for innerHTML other than at best the
behaviour of IE, but I would say it should be the serialisation of the
current DOM, in which case it should return the current, not the
original value.


However, the value attribute represents the initial (default) value of
that form control. That attribute doesn't change if the user modifies the
text themselves, does it.

I would expect the innerHTML text to change if the defaultValue property
was altered, and indeed that is the case with Opera, Mozilla and Firefox.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7
Randy Webb wrote:
[...]
For the record, both Firefox and Netscape have the same behaviour; only
IE seems to update the innerHTML. Given that, in this case, IE is the
"standard", then they all share the same "bug".

IE is not the "standard". Far from it.


If the others are attempting to emulate it, then, in this case, it is.
I was in no way suggesting that IE is *the* standard - heaven forbid!!
I think Jim has the right idea, if for no other reason than if IE is
the standard, then the others should at least do what IE does.


Thats a dangerous statement to make. IE does this:

idOfElement.inn erHTML;

but no other browser does. Does that mean they all have a bug? No.


No, but the non-standard behaviour of IE is not the topic of the
thread. It's whether other browsers are correctly emulating IE or not.

I guess it's an issue when reverse engineer something - do you
slavishly copy the behaviour, or modify it to create a "better"
version? Either way, you are going to annoy someone - the current
issue being a case in point.

It is moot whether it is more correct for innerHTML to reflect the
actual script, the user-modified script, the programmaticall y modified
script or even the browser-parsed-and-rendered script. Excellent
arguments are presented above for various cases.

Microsoft does not specify what innerHTML should do in that regard, it
seems to be intended to replace the content of a tag pair, not to read
what is currently there, though that seems to be a common use for it.
So whoever wishes to emulate innerHTML only has IE's behaviour to copy
from, and it returns the user modified value of input elements, not the
original scripted value (unless it hasn't been modified).
<URL:http://msdn.microsoft. com/workshop/author/dhtml/reference/properties/innerhtml.asp>

"When the innerHTML property is set, the given string completely
replaces the existing content of the object."

There is no statement on what innerHTML should return when "got", it
just says it is accessible.

So whoever wishes to emulate innerHTML only has IE's behaviour to copy
from, and it returns the user modified value of input elements, not the
original scripted value (unless it hasn't been modified).

None of the above should be interpreted as my endorsement of IE as an
official standard; but just one of many facets of this discussion.

--
Rob
Jul 23 '05 #8

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

Similar topics

5
2097
by: Kim Forbes | last post by:
Hi, I realize my first problem is that I'm using browser detection and not feature detection. Maybe someone can help me understand feature detection. This script works in every browser that I need it too, except Safari 1.0.2 Here is the script. Please tell me if there is any more information I can give you.
5
5197
by: joaopedrogoncalves | last post by:
Hi, I want to load an external javascript file, get its results and stick them inside a <div> block. I also want to do this in several places on a web page. This way the browser doesn't have to wait for the external resource to load to show up the page, thus giving a perceiving faster load time for the user.
2
5942
by: Iver Erling Årva | last post by:
I have come across a problem with the onKeyDown event in some of my forms. I'm using onKeyDown in <form> as a standard method to open my help screen system throughout my system, but I have discovered that If I have a <div></div> section somewhere and then load the contents of it from another file using innerHTML after the main window is loaded, the onKeyDown event doesn't trigger any more. I'm using IE6 and the structure is: <body...
1
1640
by: timchalk | last post by:
I believe I've found a problem with the Safari DOM when updating the text found within a layer. Although the layer is updated correctly visually, the underlying DOM seems to grow larger with duplicated elements rather than being reset with the new elements. I've created a test page which demonstrates this issue... http://www.qas.com/layer-test.htm The page contains an initially empty <div> element within <form> tags. When the page...
7
9324
by: garthusenet | last post by:
I have a fairly complicated application written in Javascript+DOM, and I've run into an odd problem that only shows up in Safari. Basically, after setting innerHTML of a DIV, the div ends up empty instead of with the correct content. In fact, the children of the DIV all vanish, and it becomes impossible to set the contents thereafter. The much simplified scenario: <div id='divname'> hello
8
1672
by: dd | last post by:
Hi, I've discovered a scenario where Safari 1.3 (I need to make my stuff compliant with 1.3+) gets confused about the scope of local variables WITHIN functions that were created in dynamic script blocks. I've made this example where function def has a local i variable in a loop, and it calls function abc which also has a local i variable in a loop. What happens is that Safari is not respecting the scope and is allowing the called...
7
2538
by: Tom | last post by:
I have an oo-type javascript program running perfectly on IE 6.0+, FF 1.5+, and Opera 7+ on Windows 98+, Linux (RH 9, FC 6), and Mac OS X. 4. As usual, the Safari browser is not working correctly, and because it lacks an internal debugger, I'm completely unable to see what the problem is. So I downloaded that "Drosera" debugging program, but I'm finding it useless for the following reasons: 1) I cannot "Attach" it to Safari 2.0...
1
1157
by: Gretsch | last post by:
I have modelled my program on the std code below (from http://www.w3schools.com/dom/dom_parser.asp).. It works in IE & Firefox, but does not work with Safari - nor does Safari issue the alert "Your browser cannot handle this script" ! I've seen elsewhere on this forum that Safari supports HttpRequest, but this is new technology for me. My XML is very simple (only 7 data items). - Is there a simple way to get the script below to work...
1
1463
by: Buster | last post by:
Hello, First, this works fine in IE 6.5 and 7. Second, this is javascript embedded in ASP code. The purpose of this is to assign letters to form fields that are being rendered in an ASP loop. First part, I assign a div tag for the "marker" positions: do Until rs4.EOF address = address & "<div id=""marker""></div><input type='image'
0
8432
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, 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...
0
8856
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, 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...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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,...
0
8633
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 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...
0
7365
agi2029
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...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.