473,387 Members | 1,882 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,387 software developers and data experts.

OBJECT EXPECTED ERROR.

jc
I'm trying the below and getting OBJECT EXPECTED error in
javascript.

On my aspx page I have this java script block:
<script language="javascript" type="text/javascript">
function SearchText(selectit)
{
document.getElementById('TextBox_Body').createText Range().find(selectit);
}
</script>

In vb.net I'm dynamically generate javascript

<script language='JavaScript'>
SearchText('car');
</script>

using this code and passing it the string "car":

Public Function SelectText(ByVal SearchString As String) As String
Return "<script language='JavaScript'>" + vbCrLf +
"SearchText('" + SearchString + "');" + vbCrLf + "</script>"
End Function

I force that block to run as follows and I understand this is not
javascript, but the problem appears to be with my rendered code. Below
is how I pass :

ClientScript.RegisterClientScriptBlock(Me.GetType, "client",
pkb.SelectText(TextBox_Search1.Text))


Thanks for any help or information.
Jun 27 '08 #1
2 1627
VK
On Jun 19, 10:22*pm, jc <wild...@noclient.netwrote:
*I'm trying the below and getting OBJECT EXPECTED error in
javascript.

On my aspx page I have this java script block:

<script language="javascript" type="text/javascript">
function SearchText(selectit)
{
document.getElementById('TextBox_Body').createText Range().find(selectit);}

</script>

In vb.net I'm dynamically generate javascript

<script language='JavaScript'>
SearchText('car');
</script>

using this code and passing it the string "car":

*Public Function SelectText(ByVal SearchString As String) As String
* * * * * * Return "<script language='JavaScript'>" + vbCrLf +
"SearchText('" + SearchString + "');" + vbCrLf + "</script>"
*End Function

I force that block to run as follows and I understand this is not
javascript, but the problem appears to be with my rendered code. Below
is how I pass :

ClientScript.RegisterClientScriptBlock(Me.GetType, "client",
pkb.SelectText(TextBox_Search1.Text))

Thanks for any help or information.
What you are doing server-side is irrelevant to client side: these are
two absolutely unrelated processes. To see the source of the error
generate the output page which gives you the error, select View >
Source (if IE), copy-paste here. If the page is too big or contains a
sensitive information then you may have to make a separate minimum
case still demonstrating your problem.
Jun 27 '08 #2
jc
sorry.. let me simplify. for some reason my serverside drops the
javascript block inside the form block.. i don't think this is the
problem, but here a simple test that is also failing.

The original source:

<html>
<head>
<title>
Javascript testing
</title>
</head>

<body>

<form name="form1" method="post" action="_Blank" id="form1">
<script language="javaScript" type="text/javascript">
SearchText("test");
</script>
<input name="TextBox_Body" type="text" value="this is a test"
id="TextBox_Body" />
</form>
<script language="javascript" type="text/javascript">
function SearchText(selectit)
{
document.getElementById('TextBox_Body').createText Range().find(selectit);
}
</script>
</body>
</html>

... a view source places it back on the bottom

<html>
<head>
<title>
Javascript testing
</title>
</head>

<body>

<form name="form1" method="post" action="_Blank" id="form1">
<input name="TextBox_Body" type="text" value="this is a test"
id="TextBox_Body" />
</form>
<script language="javascript" type="text/javascript">
function SearchText(selectit)
{
document.getElementById('TextBox_Body').createText Range().find(selectit);
}
</script>

<script language="javaScript" type="text/javascript">
SearchText("test");
</script>

</body>
</html>
giving me the object expected on line 20

document.getElementById('TextBox_Body').createText Range().find(selectit);
Jun 27 '08 #3

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

Similar topics

4
by: Bill | last post by:
I call a function in my .js file like this: onClick="location.href='blank.html' + generateSearchStringFromForm('section')" where section is the name of my form. The function is defined as...
2
by: jsnX | last post by:
i want a function object that is a) initialized with an STL container foo b) will search foo for an object of type foo::value_type here is my code: ...
2
by: FredC | last post by:
OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 2 Build 2600 Total Physical Memory 1,024.00 MB MDE 2003 Version 7.1.3008 ..NET Framework 1.1 Version 1.1.4322 SP1...
11
by: westplastic | last post by:
This one is driving me insane. The script works perfect on Firefox, but Internet Explorer keeps complaining about "Error Object Expected" and stuff like that. I've run it through Firefox's Java...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
4
by: loserdude84 | last post by:
Hi I keep getting the good old error 'Object Expected Error' on a site I recently built. I am really struggling with this one. Object Expected Error Line 66 <div...
1
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a...
10
RMWChaos
by: RMWChaos | last post by:
WinVista/IE7 I am getting some weird errors only in IE7, but not in FF2.0.0.8 or NN9. It even happens on this website when I click "Sign In". The error is: "A Runtime Error has occurred."...
2
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%=...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.