I had been trying to solve this error for the past days... tried a number of ways but still the error return to me eventually and its driving me to the very end!!! I keep getting this error when it reach the onblur event!!! Pls share some advice for me? All will be greatly appreciated!!
[HTML]<html>
<head><title>Sh opping Cart</title>
<script language="javas cript" type="text/javascript">
<!-- Hide javascript from older browsers
function CheckPen(qty){
if(qty=="")
alert('Hello')
}
function cart(selected) {
//Array is used to store a set of values in a single variable name
var price = new Array(1.5,1.2,1 .6,0.5,0.8,2);
var prod = new Array(0,1,2,3,4 ,5);
//the bellow var is for the place to hold the data for the calculation
var selectNo = selected.select edIndex;
var selectName = selected.option s[selectNo].value;
var list = selected.option s.size;
var choice = selected.option s[selectNo].selected;
var total = 0;
var line = "";
if (selectNo !=-1) {
// line command is for tob display in new screen
line = "<form><tab le border=2 bordercolor=blu e cellspacing=15 cellpadding=10> ";
line = line + "<tr align='center'> <th colspan=4><font size='5'>Purcha se Products"
line = line + "<tr><td align=center>St ationary<td align=center>Pr ice<td align=center>Qu antity<td align=center>Pr ice"
for(var i = 0;i<list;++i) {
choice = selected.option s[i].selected;
if (choice == true) {
itemName = selected.option s[i].value;
//display the the selected items aling with their price in a table
line = line + "<tr><td>"+sele ctName;
line = line + "<td align=center>S$ <input type=button name=priceLabel "+prod[i]+" value="+price[i]+">";
line = line + "<td><input type=text size=10 maxlength=5 name=qty"+prod[i]+" onblur='CheckPe n(qty"+prod[i]+".value)'>" ;
line = line + "<td><input type=button value=Calculate name=subTotal"+ prod[i]+" onclick=subTota l"+prod[i]+".value=priceL abel"+prod[i]+".value*qty"+p rod[i]+".value,total. value=total.val ue*1+subTotal"+ prod[i]+".value*1>" ;
}
}
line = line + "<tr><td><td><t d>Total:";
// bellow command is used to diplay the total cost of the items selected
line = line + "<td><input type=Text readonly size=6 name=total value=0>";
line = line + "</table></form>";
line = line + "</body></html>";
document.writel n(line)
}
}
// End hiding javascript-->
</script>
</head>
<body>
<form name=list>
<table>
<tr>
<td align=center><h 2><u>Shopping Cart</u></h2>
<tr>
<td>
<select name=product size=6 multiple>
<option name=pen value="Pen">Pen </option>
<option name=pencil value="Pencil"> Pencil</option>
<option name=colour value="Colour Pencil">Colour Pencil</option>
<option name=eraser value="Eraser"> Eraser</option>
<option name=ruler value="Ruler">R uler</option>
<option name=high value="Highligh ter">Highlighte r</option>
</select>
<tr>
<td><input type="button" value="Add To Cart" onClick="cart(l ist.product)">
</table>
</form>
</body>
</html>[/HTML]
Mar 9 '07
19 2007 acoder 16,027
Recognized Expert Moderator MVP
Wow - the pinnacle of usefulness. I hope I've said everthing I meant to say, or if not I remember it real soon.
See this post. You only need to edit a post if you've made a mistake (which you should realise by re-reading your response).
If you've just got something to add, there's no harm in posting again.
Thanx Logician and acoder!!! ^^?
acoder 16,027
Recognized Expert Moderator MVP
Thanx Logician and acoder!!! ^^?
Nah. It was Logician really who pointed out the most important things. Still, if you must, you're welcome anytime!
Nah. It was Logician really who pointed out the most important things. Still, if you must, you're welcome anytime!
Object expected.
I have a form button calling a javascript file but I am getting object expected error.
form code taken from file c:\Databases\ph pscripts\viewPa rts.php -
<? include("c:\Databases\javascripts\getParts.js") ?>
-
<form name="parts" onSubmit="getParts.js"> //object expected
-
<input type="button" name="getParts" id="getParts" value="getParts" onclick="Parts();" />
-
</form>
-
the javasscript being called getParts.js -
<script language="JavaScript">
-
function Parts()
-
{
-
var url="http://localhost/Databases/phpscripts/parts.php";
-
if(window.XMLHttpRequest)
-
http = new XMLHttpRequest();
-
else if (window.ActiveXObject)
-
http = new ActiveXObject(Microsoft.XMLHTTP);
-
http.onreadystatechange = function()
-
{
-
alert(http.readyState);
-
if(http.readyState == 4)
-
{
-
alert(http.status)
-
if(http.status == 200)
-
{
-
alert("hi");
-
-
}
-
else
-
{
-
alert(http.status);
-
}
-
}
-
}
-
http.open("GET", url, true);
-
http.setRequestHeader("text");
-
http.send(null);
-
}
-
</script>
-
The alert is just to verify ajax call works. Can anyone see what is causing the problem. any help appreciated.
Object expected.
I have a form button calling a javascript file but I am getting object expected error.
Too vague. What if anything do you get in the fireFox console?
Too vague. What if anything do you get in the fireFox console?
Nothing, for some reason beyond my comprehension, my html file is not showing up in the dir having restarted apache server. I put the function being called into the html file the calls it and it worked fine. Now even though I have the complete file path of the external file in the include and the form action, the action is not seeing the external file, which is in the same dir.
The html file form1.html is in C:\Databases\we bpages
the javascript file Hi.js is in C:\Databases\ja vascripts
html file form1.html -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<HTML>
-
<HEAD>
-
<TITLE> New Document </TITLE>
-
<META NAME="Generator" CONTENT="EditPlus">
-
<META NAME="Author" CONTENT="">
-
<META NAME="Keywords" CONTENT="">
-
<META NAME="Description" CONTENT="">
-
<script src="c:\Databases\javascripts\Hi.js"></script>
-
</HEAD>
-
-
<BODY>
-
<form action="c:\Databases\javascripts\Hi.js">
-
<input type="button" value="Hi" onclick="Hi();" />
-
</form>
-
</BODY>
-
</HTML>
-
javascript file Hi.js -
<script type="text/javascript" language="javascript">
-
alert("hi");
-
</script>
-
Not sure if I need full path in the action though since its in the include. Can anyone help me on this?
RPJD
Nothing, for some reason beyond my comprehension, my html file is not showing up in the dir having restarted apache server. I put the function being called into the html file the calls it and it worked fine. Now even though I have the complete file path of the external file in the include and the form action, the action is not seeing the external file, which is in the same dir.
The html file form1.html is in C:\Databases\we bpages
the javascript file Hi.js is in C:\Databases\ja vascripts
html file form1.html -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<HTML>
-
<HEAD>
-
<TITLE> New Document </TITLE>
-
<META NAME="Generator" CONTENT="EditPlus">
-
<META NAME="Author" CONTENT="">
-
<META NAME="Keywords" CONTENT="">
-
<META NAME="Description" CONTENT="">
-
<script src="c:\Databases\javascripts\Hi.js"></script>
-
</HEAD>
-
-
<BODY>
-
<form action="c:\Databases\javascripts\Hi.js">
-
<input type="button" value="Hi" onclick="Hi();" />
-
</form>
-
</BODY>
-
</HTML>
-
javascript file Hi.js -
<script type="text/javascript" language="javascript">
-
alert("hi");
-
</script>
-
Not sure if I need full path in the action though since its in the include. Can anyone help me on this?
RPJD
Hi.js is actually -
<script type="text/javascript" language="javascript">
-
function Hi()
-
{
-
alert("hi");
-
}
-
</script>
-
Hi.js is actually -
<script type="text/javascript" language="javascript">
-
function Hi()
-
{
-
alert("hi");
-
}
-
</script>
-
Is it possible for an onclick function to call a a javascript function within an external javascript file without passing any parameters? The script being called is an xmlhttprequest which is getting info from a database query and returning the info. I not sure whether the "object expected" is a parameter or the file containing the script being called by onclick. The external file has been included with a full file path -
<script src="http://localhost/ProjectFolder/Filename"></script>
-
Can anyone offer a solution?
rpjd
acoder 16,027
Recognized Expert Moderator MVP
If you're using Ajax, why are you submitting a form?
You're trying to submit to a js file when in fact you should submit to a script which can deal with the response.
On which line does the error occur? Try checking the Firefox console.
If you're using Ajax, why are you submitting a form?
You're trying to submit to a js file when in fact you should submit to a script which can deal with the response.
On which line does the error occur? Try checking the Firefox console.
Can someone help me with this?
I am trying to submit a form to update/add a database table
here is he code. It is giving me object expected at
paramter is var poststr.
rpjd
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Enos Meroka |
last post by:
Hallo,
I am a student doing my project in the university.. I have been trying
to compile the program using HP -UX aCC compiler, however I keep on
getting the following errors.
=================================================================
Error 19: "CORBAManagerMessages.h", line 4 # Unexpected 'std'.
using std::string;
^^^
|
by: Franko |
last post by:
I get the following error. Please help
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001:
Identifier expected
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002:
; expected
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519:
Invalid token '(' in class, struct, or interface member declaration
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(9,2): error CS0116: A
namespace does not...
|
by: Franko |
last post by:
I get the following error. Please help
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001:
Identifier expected
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002:
; expected
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519:
Invalid token '(' in class, struct, or interface member declaration
c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(9,2): error CS0116: A
namespace does not...
|
by: HKSHK |
last post by:
This list compares the error codes used in VB.NET 2003 with those used
in VB6.
Error Codes:
============
3: This Error number is obsolete and no longer used. (Formerly:
Return without GoSub)
5: Procedure call or argument is not valid.
6: Overflow.
7: Out of memory.
|
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 Javscript issue. but how do we, mere mortals who know nothing of anything about Java, scripts, etc, fix this? Is there a programm, does MS have any fix? is there any tweak like in the Registry, or whatever, how do I access anyihint java without in IE 7...
| |
by: Lawrence Spector |
last post by:
I ran into a problem using g++. Visual Studio 2005 never complained
about this, but with g++ I ran into this error. I can't figure out if
I've done something wrong or if this is a compiler bug. Here's a very
simple example which should illustrate what I'm doing.
#include <iostream>
template <class T>
class TestBase
{
|
by: BSand0764 |
last post by:
I'm getting an error that I can't seem to resolve. When I compile the
Functor related logic in a test program, the files compile and execute
properly (see Listing #1).
However, when I incorporate the same logic within my simulation, the
class that implements the functor logic has problems compiling. I get
the following errors:
-- Building myTest.cpp --
|
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="<%= ViewData %>" />
-
|
by: vijayrvs |
last post by:
SearchCrawler.java
The program search crawler used to search the files from the website.
From the following program i got 7 compiler error. can any body clarify it and provide me solution.
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |