简体   繁体   中英

Invalid Argument error in javascript

My Javascript code goes something like this

Var Mainurl=”http://localhost/Employee/SearchEmployee.aspx?”
var url = { "eid" :empID, 
"DOB" : dob,
 "Gender" : gender,
 "Category" : category, 
"IsActive" :isActive 
};
window.open(Mainurl + Ext.urlEncode(url), 'Search Employee', "status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=1, scrollbars=0,height=700, width=1000" );

When I execute my application in IE (v6.0) it gives error “invalid arguments” at window.open but works fine in Firefox. Anyone has any idea how can I solve this?

Change your first line from:

Var Mainurl=”http://localhost/Employee/SearchEmployee.aspx?”

To

var Mainurl="http://localhost/Employee/SearchEmployee.aspx?";

Var should be var and your speach marks should be " instead of .

Please correct the syntaxes first. Like Var should be var Try the following url.

var url = { eid :empID, 
 DOB : dob,
 Gender : gender,
 Category : category, 
IsActive :isActive 
};

Ext.urlEncode() takes an object and converts it to an encoded URL. eg Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2" . ..

very surprised that such thing works in FF. you should use

var mainurl...

and NOT

Var Mainurl...

var is always var (lowercase). and variables like mainurl are lowercase too (but this is "just" convention).

so first change the Var to a var. and check if Ext.urlEncode is loaded and compatible with ie6 (don't know, but think its an js lib, right?).

and then get yourself a update on IE ;) (shouldnt support IE 6 anymore, way to much headache)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM