|
-
Nov 19th, 2004, 07:10 AM
#1
Thread Starter
Hyperactive Member
[java script] different browsers
Hi,
I have the following code on an asp page and it works fine from a mozilla bowser but when run from internet explorer is doesnt seem to work at all.
function Approach (theform) {
var pregen = 0 ;
pregen = theform.sel_app_1.value
alert(pregen)
return;
}
called from a select box as follows.
onChange= "Approach(this.form) ;"
With the mozilla browser it displays the selected value
With internet explorer it just displays the default value of 0
If any one has even the slightest idea of what the problem is here , please let me know.
Thank
-
Nov 19th, 2004, 07:14 AM
#2
How are you getting that to run without semicolons in place?
-
Nov 19th, 2004, 07:38 AM
#3
Thread Starter
Hyperactive Member
There are semi colons on the code on the page, deleted them by accident on the post.
-
Nov 19th, 2004, 07:55 AM
#4
Retired VBF Adm1nistrator
I've never used the this keyword in js before... I'd normally just use document.myform or something to that effect...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Nov 19th, 2004, 08:50 AM
#5
Thread Starter
Hyperactive Member
Even when I use the the actual form name in the function , ie. in effect ignoring the input parameter, it still gives me a value of 0 .
-
Nov 19th, 2004, 09:05 AM
#6
Frenzied Member
Why not:
Code:
<textarea onchange="Approach(this)"></textarea>
...
function Approach (_obj) {
var pregen = 0 ;
pregen = _obj.value
alert(pregen)
return;
}
Last edited by Acidic; Nov 19th, 2004 at 09:10 AM.
Have I helped you? Please Rate my posts. 
-
Nov 19th, 2004, 11:46 AM
#7
Thread Starter
Hyperactive Member
I am calling it from a drop down select box, eventually I want the function to do calculations on a few different drop down boxes on the form.
Functions calls ok ,but it just cant read the selected value of the dropdown box.
-
Nov 19th, 2004, 11:50 AM
#8
Frenzied Member
Code:
<select onchange="Approach(this.value)">
<option value="abc">abc</option>
...
</select>
Have I helped you? Please Rate my posts. 
-
Nov 19th, 2004, 12:13 PM
#9
Thread Starter
Hyperactive Member
Its in the function the problem is:
function Approach (theform) {
var pregen = 0 ;
pregen = theform.sel_app_1.value; alert(pregen);
return;
}
theform.sel_app_1.value gives me a value of 0 no matter what I select.
Works fine in mozilla.
-
Nov 20th, 2004, 09:49 AM
#10
Frenzied Member
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 20th, 2004, 10:05 AM
#11
A good reason always to use the value attribute.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|