Solved

java script error - object  not found

Posted on 2011-03-11
4
231 Views
Last Modified: 2012-08-14
I have this code

<asp:HyperLink ID="hlMainImageChange"
                                              NavigateUrl="javascript:ImageChange('main', 'change');" runat="server">Change</asp:HyperLink>


That tries to call this code:

 function ImageChange(strImgType, strFunction) {

        var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
     
        var MyArgs = window.showModalDialog("../change_file.aspx?Product_ID=" + prodid + "&ImageType=" + strImgType + "&FunctionType=" + strFunction, MyArgs, WinSettings)

    }


 but does not make it there because i get a error

Microsoft JScript runtime error: Object expected



0
Comment
Question by:vbnetcoder
  • 2
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 35111108
You're trying to use "MyArgs" in the line that defines it.  I don't think that works.

var MyArgs = window.showModalDialog("../change_file.aspx?Product_ID=" + prodid + "&ImageType=" + strImgType + "&FunctionType=" + strFunction, MyArgs, WinSettings)
0
 

Author Comment

by:vbnetcoder
ID: 35111114
It was working fine in Google Chrome
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
ID: 35111170
Then it is passing a 'null' in Chrome and that is what Microsoft Jscript is objecting to.  Every browser has it's own javascript interpreter with it's own differences and Microsoft's Jscript in IE8 seems to be the pickiest.
0
 

Author Closing Comment

by:vbnetcoder
ID: 35112405
ty
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now