IE input event OnChange?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

IE input event OnChange?

Post by wvoyance »

Does IE support <input.....onChange=...>?
How about firefox?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: IE input event OnChange?

Post by requinix »

User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: IE input event OnChange?

Post by wvoyance »

requinix wrote:Good question.

I indeed check those before I asked.
There is no explicit answer. You can try.
I am concerning about onchange and in input and for IE, particularly.
The answer I found are all very vague, and one of the problem I asked without answer so far seems to related to this
point.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: IE input event OnChange?

Post by requinix »

wvoyance wrote:The answer I found are all very vague
Quite suitable considering how vague your question is.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: IE input event OnChange?

Post by social_experiment »

wvoyance wrote:Does IE support <input.....onChange=...>?
How about firefox?
You could create some code to test this; the results should satisfy your curiosity
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: IE input event OnChange?

Post by wvoyance »

social_experiment wrote:
wvoyance wrote:Does IE support <input.....onChange=...>?
How about firefox?
You could create some code to test this; the results should satisfy your curiosity
I indeed created and tested, therefore I came here to ask whether have others had such experience.

The code I created, tested, and discussed is viewtopic.php?f=68&t=135952
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: IE input event OnChange?

Post by social_experiment »

http://reference.sitepoint.com/html/eve ... s/onchange
According to this url IE does support the event
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: IE input event OnChange?

Post by wvoyance »

social_experiment wrote:http://reference.sitepoint.com/html/eve ... s/onchange
According to this url IE does support the event
Yes, that page seems to be pretty clear. But at the later part it said "inline statement" should be avoided.
I do not know what other "more explicit" form should I write for such event?

Furthermore, as I tested, the event did not triggered as in FireFox do.

What follows is my program up-to-date:

======================================

<html>
<head>
<script src="../js/jquery.js" type="text/javascript"></script>
<title>insert many</title>
</head>
<body>
// javascript in the head cannot access object in the body
<script type="text/javascript"><!--
..... some code omitted here....
function start(str){
isb = parseInt(str.substr(0,12));
limit = isb+10;
for (isb; isb < limit; isb++){
isbn=fix_CheckSum(isb+'');

var surl="insert_one_book.php";
var pars="isbn="+isbn;
$.ajax({
url: surl,
dataType: 'json',
data: pars,
async: false,
success: function(textDoc){}});
};
}
//--></script>
<form method="get">
enter one ISBN: <input type="text" name="isbn" onChange="start(this.value)">
<button type="submit">Submit</button>
</form>
</body>
</html>
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: IE input event OnChange?

Post by social_experiment »

Can you paste the code on insert_one_book.php
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: IE input event OnChange?

Post by wvoyance »

Let me make a simple version:

<html>
<head>
<title>insert many books</title>
</head>
<body>
<script type="text/javascript"><!--
function start(str){
alert ("in loop ");
}
//--></script>
<form method="get">
enter one ISBN:
<input type="text" name="isbn"
onChange="start(this.value)">
<button type="submit">Submit</button>
</form>
</body>
</html>
Last edited by wvoyance on Wed Jun 27, 2012 8:19 pm, edited 2 times in total.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: IE input event OnChange?

Post by social_experiment »

I probably should have asked for this from the start: do you have a url to the script instead
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: IE input event OnChange?

Post by wvoyance »

social_experiment wrote:I probably should have asked for this from the start: do you have a url to the script instead
Let me made it simple. The present program only contains an event, if trigered it will pop up a window.
But it does not triger in IE. The error message is also clear saying object do not support such event.
===================================================
<html>
<head>
<title>insert many books</title>
</head>
<body>
<script type="text/javascript"><!--
function start(str){
alert ("in loop ");
}
//--></script>
<form method="get">
enter one ISBN:
<input type="text" name="isbn"
onChange="start(this.value)">
<button type="submit">Submit</button>
</form>
</body>
</html>
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: IE input event OnChange?

Post by social_experiment »

I retyped the script on a new page in my editor and it worked in IE9. This might seem simplistic but try recreating the script (the form giving the issue) and see what happens
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: IE input event OnChange?

Post by wvoyance »

social_experiment wrote:I retyped the script on a new page in my editor and it worked in IE9. This might seem simplistic but try recreating the script (the form giving the issue) and see what happens

retype? You simply need to copy and paste. I don't believe it will wok.
I have tried on many machines. I am IE9.0.8112.16421
rev. 9.0.7

Attached is my screen. There is not only no response, but has error message explicitly, although it is in Chinese.
Attachments
onchange.png
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: IE input event OnChange?

Post by social_experiment »

wvoyance wrote:retype? You simply need to copy and paste. I don't believe it will wok.
I did copy and paste it. Then i retyped it and it worked; 9.0.8112.16421 is the same version is use.

Code: Select all

<html>
<head> 
 <title>Testing onChange again</title>
</head>
<body>
 <script type="text/javascript" ><!--
	function foo(str)
	{
		alert(str);
	}
 //--></script>
 <form method="get" >
 enter one ISBN:
 <input type="text" name="field1" onchange="foo(this.value);" />
 <button type="submit">Submit</button>
 </form>
</body>
</html>
Here is a snippet i created from scratch; it also works in IE 9
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply