Page 1 of 2
IE input event OnChange?
Posted: Mon Jun 25, 2012 9:46 pm
by wvoyance
Does IE support <input.....onChange=...>?
How about firefox?
Re: IE input event OnChange?
Posted: Mon Jun 25, 2012 9:57 pm
by requinix
Re: IE input event OnChange?
Posted: Tue Jun 26, 2012 12:14 am
by wvoyance
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.
Re: IE input event OnChange?
Posted: Tue Jun 26, 2012 3:07 am
by requinix
wvoyance wrote:The answer I found are all very vague
Quite suitable considering how vague your question is.
Re: IE input event OnChange?
Posted: Tue Jun 26, 2012 4:59 am
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
Re: IE input event OnChange?
Posted: Tue Jun 26, 2012 7:47 am
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
Re: IE input event OnChange?
Posted: Tue Jun 26, 2012 8:31 am
by social_experiment
Re: IE input event OnChange?
Posted: Tue Jun 26, 2012 7:44 pm
by wvoyance
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>
Re: IE input event OnChange?
Posted: Wed Jun 27, 2012 2:21 am
by social_experiment
Can you paste the code on insert_one_book.php
Re: IE input event OnChange?
Posted: Wed Jun 27, 2012 2:30 am
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>
Re: IE input event OnChange?
Posted: Wed Jun 27, 2012 2:58 am
by social_experiment
I probably should have asked for this from the start: do you have a url to the script instead
Re: IE input event OnChange?
Posted: Wed Jun 27, 2012 8:05 pm
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>
Re: IE input event OnChange?
Posted: Thu Jun 28, 2012 1:26 am
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
Re: IE input event OnChange?
Posted: Thu Jun 28, 2012 2:32 am
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.
Re: IE input event OnChange?
Posted: Thu Jun 28, 2012 3:03 am
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