473,402 Members | 2,072 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,402 software developers and data experts.

javascript "Error: Expected ';'"

Hi there,

I am driving myself crazy over this problem.

I have used this very same function in another page without any
problems, but now I am experiencing the "Error: Expected ';'" when i
try and run it, and it doesn't fire (obviously, because there is an
error).

The code is:

function SetDetailValue(i) {
opener.document.<%=Request("tbm")%>.value = i;
window.close();
}

the variable i is passed a string ('d1','d2' etc)

The error occurs (apparently) on the first line.

Please will someone help me with this.

I think maybe I am making a mistake in how I am assigning the variable
into the form value.

Thanks in advance

Andrew

Sep 22 '05 #1
5 19018
Just to say, when the page is compiled (so the <%=Request("tbm")%> is
completed) the script looks like this:

<SCRIPT LANGUAGE="JavaScript">
function Close() {
window.close();
}
function SetDetailValue(i) {
opener.document.frmES.1_sDependant_dCode.value = i;
window.close();
}
</SCRIPT>

Sep 22 '05 #2
Looks like the problem isn't Javascript but your JSP/ASP code within
the <%%> tags. First of all is this JSP or ASP. If it is JSP, then
the syntax needs to be request.getParameter("requestvariablename"). I
have not done ASP in a while so I can't remember the syntax for it. I
do remember that there are two different methods on the request object
to get the parameters (one is for query strings (get methods) and the
other is for form data (post methods)).

Bakari
theroo wrote:
Just to say, when the page is compiled (so the <%=Request("tbm")%> is
completed) the script looks like this:

<SCRIPT LANGUAGE="JavaScript">
function Close() {
window.close();
}
function SetDetailValue(i) {
opener.document.frmES.1_sDependant_dCode.value = i;
window.close();
}
</SCRIPT>


Sep 22 '05 #3
Lee
theroo said:

Just to say, when the page is compiled (so the <%=Request("tbm")%> is
completed) the script looks like this:

<SCRIPT LANGUAGE="JavaScript">
function Close() {
window.close();
}
function SetDetailValue(i) {
opener.document.frmES.1_sDependant_dCode.value = i;
window.close();
}
</SCRIPT>


The problem is the element name that begins with a digit.
That's not allowed. If you change it to any valid character,
the error goes away.

Sep 22 '05 #4
Lee wrote:
theroo said:
Just to say, when the page is compiled (so the <%=Request("tbm")%> is
completed) the script looks like this:

<SCRIPT LANGUAGE="JavaScript">
function Close() {
window.close();
}
function SetDetailValue(i) {
opener.document.frmES.1_sDependant_dCode.value = i;
window.close();
}
</SCRIPT>

The problem is the element name that begins with a digit.
That's not allowed. If you change it to any valid character,
the error goes away.


Presuming that it is a name and not an id, this will work too:

opener.document.frmES.elements['1_sDependant_dCode'].value = i;
If '1_sDependant_dCode' is an id, it will probably still work but it is
not valid HTML - IDs aren't allowed to start with a digit. AFAIK most
browsers will tolerate it anyway.

--
Rob
Sep 22 '05 #5
Thank you all.. This has been fixed now and is working fine and super.

I really appreciate the help and the swift response.

Regards

Andrew.

Sep 23 '05 #6

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

Similar topics

5
by: Rick | last post by:
I wrote the following code as part of a page where users can reorder a list of items by highlighting an item in a list box and clicking an "up" or "down" button to move the items around. The code...
2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
4
by: Daniel | last post by:
Hi, I have problem to get the control id and set its visible to true/false(mean show/hide). here is my code: <%@ Control Language="vb" AutoEventWireup="false" Codebehind="ucNavbar.ascx.vb"...
16
by: Steve Chapel | last post by:
When I load the page <https://bugzilla.mozilla.org/attachment.cgi?id=237739with Internet Explorer 7 RC 1, I get the error "Object Expected" at line 174. When I click on the button, I also get the...
1
by: monudjn | last post by:
Hi I am implementing ajax in portal. Using ajax i am able to updating the content of portlets asynchronously. However i am facing a problem The Problem: While submitting the form i am getting...
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: jman | last post by:
i'm getting an "object expected" error in ie - not ff. in the BODY onload attribute i call a function that's loaded from an external file. i've narrowed the error down to the fact it cannot...
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="<%=...
4
by: makweatan | last post by:
Hello, Can anyone please help me, where did I go wrong..? Line : 388 Char : 1 Error : Object Expected Code : 0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
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: 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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.