473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why was there an error?

Hello, friends,

A very simple code as follows, but got an error: Microsoft JScript runtime
error: 'BHnz1' is undefined.

Any ideas? Thanks a lot.

-----------------

<body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
<form id="Form1" method="post" runat="server">
<OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>

Mar 15 '06 #1
9 1197
It appears that the client side object BHnz1 was unable to be instantiated.
There could be many reasons depending on what BHnz1 is, but my first guesses
would be a security related issue or the component cannot be found.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hello, friends,

A very simple code as follows, but got an error: Microsoft JScript runtime
error: 'BHnz1' is undefined.

Any ideas? Thanks a lot.

-----------------

<body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
<form id="Form1" method="post" runat="server">
<OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>

Mar 15 '06 #2
we have a VB app using this component and worked fine.

and, how about security? where to find clues? thanks.

"Steve C. Orr [MVP, MCSD]" wrote:
It appears that the client side object BHnz1 was unable to be instantiated.
There could be many reasons depending on what BHnz1 is, but my first guesses
would be a security related issue or the component cannot be found.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hello, friends,

A very simple code as follows, but got an error: Microsoft JScript runtime
error: 'BHnz1' is undefined.

Any ideas? Thanks a lot.

-----------------

<body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
<form id="Form1" method="post" runat="server">
<OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>


Mar 15 '06 #3

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hello, friends,

A very simple code as follows, but got an error: Microsoft JScript runtime
error: 'BHnz1' is undefined.

Any ideas? Thanks a lot.

-----------------

<body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
<form id="Form1" method="post" runat="server">
<OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>


If you are using Visual Studio 2005 for this then check the source code
that is being generated on the client. My guess is that the id might be
getting some other text added to it. Sometimes you might see your server
side id go from BHnz1 to something like CTL001_BHNz1. If something like
this is happening then you would need to update your javascript to reference
that. Can you post the html from View... Source from the web browser.

jjardine
Mar 15 '06 #4
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Xuehanzi</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout" onload="initCOMComponent();">
<form name="Form1" method="post" action="Xhnz.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwtNjU0MzcyMTk1Ozs+gVaCEI14+RbjhEr0J7c8cIw vYIk=" />

<OBJECT id="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP: 64px"
classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
name="BHnz1" VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>
</HTML>
"James Jardine" wrote:

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hello, friends,

A very simple code as follows, but got an error: Microsoft JScript runtime
error: 'BHnz1' is undefined.

Any ideas? Thanks a lot.

-----------------

<body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
<form id="Form1" method="post" runat="server">
<OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>


If you are using Visual Studio 2005 for this then check the source code
that is being generated on the client. My guess is that the id might be
getting some other text added to it. Sometimes you might see your server
side id go from BHnz1 to something like CTL001_BHNz1. If something like
this is happening then you would need to update your javascript to reference
that. Can you post the html from View... Source from the web browser.

jjardine

Mar 15 '06 #5

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.com...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Xuehanzi</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout" onload="initCOMComponent();">
<form name="Form1" method="post" action="Xhnz.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwtNjU0MzcyMTk1Ozs+gVaCEI14+RbjhEr0J7c8cIw vYIk=" />

<OBJECT id="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP: 64px"
classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
name="BHnz1" VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>
</HTML>
"James Jardine" wrote:

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
> Hello, friends,
>
> A very simple code as follows, but got an error: Microsoft JScript
> runtime
> error: 'BHnz1' is undefined.
>
> Any ideas? Thanks a lot.
>
> -----------------
>
> <body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
> <form id="Form1" method="post" runat="server">
> <OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
> 64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
> VIEWASTEXT>
> <PARAM NAME="_ExtentX" VALUE="8625">
> <PARAM NAME="_ExtentY" VALUE="9155">
> </OBJECT>
> </form>
> <script language="javascript">
> function initCOMComponent()
> {
> BHnz1.GetBinaryDataFile("test.dat");
> }
> </script>
> </body>
>


If you are using Visual Studio 2005 for this then check the source code
that is being generated on the client. My guess is that the id might be
getting some other text added to it. Sometimes you might see your
server
side id go from BHnz1 to something like CTL001_BHNz1. If something like
this is happening then you would need to update your javascript to
reference
that. Can you post the html from View... Source from the web browser.

jjardine


Does it make a difference if you try to call your method by using
Form1.GetElementById("BHnz1") instead of just BHnz1? Just an idea. Good
luck.
Mar 15 '06 #6
nope...

"James Jardine" wrote:
Does it make a difference if you try to call your method by using
Form1.GetElementById("BHnz1") instead of just BHnz1? Just an idea. Good
luck.

Mar 15 '06 #7
Is this an ActiveX component you're trying to instantiate? What does it do?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
we have a VB app using this component and worked fine.

and, how about security? where to find clues? thanks.

"Steve C. Orr [MVP, MCSD]" wrote:
It appears that the client side object BHnz1 was unable to be
instantiated.
There could be many reasons depending on what BHnz1 is, but my first
guesses
would be a security related issue or the component cannot be found.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
> Hello, friends,
>
> A very simple code as follows, but got an error: Microsoft JScript
> runtime
> error: 'BHnz1' is undefined.
>
> Any ideas? Thanks a lot.
>
> -----------------
>
> <body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
> <form id="Form1" method="post" runat="server">
> <OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
> 64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
> VIEWASTEXT>
> <PARAM NAME="_ExtentX" VALUE="8625">
> <PARAM NAME="_ExtentY" VALUE="9155">
> </OBJECT>
> </form>
> <script language="javascript">
> function initCOMComponent()
> {
> BHnz1.GetBinaryDataFile("test.dat");
> }
> </script>
> </body>
>


Mar 15 '06 #8
there are several issues hwne using com objects in the browser.

1) the object is not available for reference until form load (client side)
2) at form load the object is available, but may not actualy loaded. you
need to check readyState before accessing any properties.
3) the active/x control must be marked safe for scripting, or the browser
will not load.

try:

function initCOMComponent()
{
// test if browser allows creating of object

var o = document.getElementById("BHnz1");
if (o == null)
{
alert("this page requires you to install and trust the active/x
control 'xyz'");
return;
}

// spin until com object initialized

if (o.readyState != 4)
{
window.setTimeout("initCOMComponent()",10);
return;
}

// call methods

o.GetBinaryDataFile("test.dat");
}
-- bruce (sqlwork.com)


"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hello, friends,

A very simple code as follows, but got an error: Microsoft JScript runtime
error: 'BHnz1' is undefined.

Any ideas? Thanks a lot.

-----------------

<body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
<form id="Form1" method="post" runat="server">
<OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>

Mar 16 '06 #9
Thanks. but, how to mark the active/x control as safe for scripting?
"Bruce Barker" wrote:
there are several issues hwne using com objects in the browser.

1) the object is not available for reference until form load (client side)
2) at form load the object is available, but may not actualy loaded. you
need to check readyState before accessing any properties.
3) the active/x control must be marked safe for scripting, or the browser
will not load.

try:

function initCOMComponent()
{
// test if browser allows creating of object

var o = document.getElementById("BHnz1");
if (o == null)
{
alert("this page requires you to install and trust the active/x
control 'xyz'");
return;
}

// spin until com object initialized

if (o.readyState != 4)
{
window.setTimeout("initCOMComponent()",10);
return;
}

// call methods

o.GetBinaryDataFile("test.dat");
}
-- bruce (sqlwork.com)


"Andrew" <An****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
Hello, friends,

A very simple code as follows, but got an error: Microsoft JScript runtime
error: 'BHnz1' is undefined.

Any ideas? Thanks a lot.

-----------------

<body MS_POSITIONING="GridLayout" onload="initCOMComponent();" >
<form id="Form1" method="post" runat="server">
<OBJECT id="BHnz1" name="BHnz1" style="Z-INDEX: 101; LEFT: 136px; TOP:
64px" classid="clsid:60EB3120-469D-5E79-839D-AB53DA2DF932"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8625">
<PARAM NAME="_ExtentY" VALUE="9155">
</OBJECT>
</form>
<script language="javascript">
function initCOMComponent()
{
BHnz1.GetBinaryDataFile("test.dat");
}
</script>
</body>


Mar 16 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jenny | last post by:
Hi, I have a java socket program running on AIX 4.3.3.0 platform. It opens a socket and sends data to our customer over a leased fractional T1 line. The line is always connected. However,...
0
by: Xiaofeng Zhang | last post by:
when I compile my project setting, there are many LINK errors. But when I compile my project under debug setting, everything is OK. How can I deal with it? The errors is followed. Linking......
2
by: Jeff | last post by:
Hello I am creating a web client in c#. I use the "Add a Web Reference" wizard to read a WSDL file, then I simply call the method for the remote service. I get the floowing error returned when...
1
by: ColinWard | last post by:
Hi there. I have the following code in the open event of a form. Most of it sets or checks the value of certain variables so that the form opens properly. It also sets the recordsource for the...
0
by: NOSPAM | last post by:
Guys, I get the 'There was an error executing the command' error message. I an using win xp & Access 2002. I created a database using the MS Access template 'Order Entry' I have entered...
15
by: Walter Dnes (delete the 'z' to get my real address | last post by:
A long time ago, in a place far away, there was an OS called DOS that had standard numeric return codes. Regardless of the programming language used, the same error return codes were supposed to...
13
by: R Reyes | last post by:
is there a way to avoid the validateRequest error page in my code behind file? i can't seem to find a way to handle the error w/o an error code or exception being thrown... i am NOT looking for...
12
by: Jan | last post by:
Hi: I've got the Error 3197 problem ("The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time.") in a client...
13
by: andrewanderson | last post by:
hi all, i'm wondering is there any other alternative to do a timestamp which consists of date and time!! below is a program i've created but its too long and to large i would like to know other...
1
by: Earl Anderson | last post by:
I have a form with many fields, each of which has their separate record sources in a split db. Today, several users throughout the afternoon encountered the following message when accessing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.