473,769 Members | 7,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java script - forms..please help ASAP!

2 New Member
hi!

i'm new to java script. i'm doing a web page, where i can increment the value of a text field by pressing a button. Each time i press the button, the value in the text field should be incremented

i wrote a code for this and it returned an error

Line: 9
Char: 2
Error: Object Expected
Code: 0

The code is given below. Please tell me if there's an error in the code, or if you have a different solution - please let me know. i'm open to all ideas. would be nice if i got a solution as early as possible. thank you so much!


[HTML]<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaS cript">
<!-- Beginning of JavaScript -

function encode(text)
{
var temp= parseint(text);
temp +=1;
text = temp.toString() ;
document.form1. result.value = text;
}
// - End of JavaScript - -->
</SCRIPT>

</HEAD>
<BODY bgcolor="beige" >


<FORM name="form1">
<table border=0><tr><b r><td>
<INPUT TYPE=Button VALUE="submit" onClick="encode (this.form.inpu t.value)"><tr>< td>
Result:<td><INP UT NAME="result" TYPE=Text>

</table>
</FORM>
</BODY>
</HTML>[/HTML]
Oct 10 '07 #1
3 1470
gits
5,390 Recognized Expert Moderator Expert
hi ...

welcome to TSDN ...

have a look at the following (fixed) code:

[HTML]<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaS cript">
function encode(text) {
var temp= parseInt(text);
temp +=1;
text = temp.toString() ;
document.form1. result.value = text;
}
</SCRIPT>
</HEAD>
<BODY bgcolor="beige" >
<FORM name="form1">
<table border=0>
<tr>
<td><INPUT TYPE=Button VALUE="submit" onClick="encode (this.form.resu lt.value)">
Result:
<INPUT NAME="result" TYPE=Text value="0">
</td>
</tr>
</table>
</FORM>
</BODY>
</HTML>
[/HTML]
kind regards

ps: that is a hotfix :) ... following things were wrong: parseInt - js is case-sensitive, in your onclick-function you refered this.form.input .value - but input should be result, tabletags were completly messed up ... , value for the input type text should be 0 per default or you have to handle NaN in your function ...

hints: the language attribute for the script tag is deprecated use type="text/javascript" instead ..., write tag- and attribute-names in lower case, put quotes around attribute values ...
Oct 10 '07 #2
siddhu085
2 New Member
Thanks a bunch gits!!!!!!!!!!!

its working perfectly!

thank you again!!!

warm regards
Oct 11 '07 #3
gits
5,390 Recognized Expert Moderator Expert
hi ...

glad to hear that ;) ... post back to the forum anytime you have more questions ...

kind regards
Oct 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

73
8070
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities as a standard portable part of the core language, the LISP package, and the java.lang package, respectively. Both have big integers, although only LISP has rationals as far as I can tell. Because CL supports keyword arguments, it has a wider range...
1
3967
by: Chris | last post by:
Our company developed the last couple of years a development tool: using this tool we configure and program (using SQL, and Java-Script) very, very easy an application. The output of the effort is a state-of-the art n-tier, j2ee, pure-java/xml-Application - but without coding one single line java. And: the application looks really sexy. Some of the mentioned features are patented in US. Everything goes well, our customers loves this way of...
6
1917
by: Daniel Walzenbach | last post by:
Hi, I have an application using "Forms authentication". Everything works perfectly well except when I try to open a new page with java script like the following: <script language='javascript'>window.open (myPage.aspx','','Fullscreen=no; Scrollbars=yes; Menubar=no; Locationbar=no; Resizable=yes; Status=no;') </script>
7
1973
by: dbabin | last post by:
I have a java script function enableServerList() {document.getElementById("ddlServers").disabled=false } function disableServerList() {document.getElementById("ddlServers").disabled=true } This greys out a drop down list as expected. The problem is, when I click on the "get Report" button, I need a way to say in asp code:
36
2091
by: Robert Baer | last post by:
I used Google and found some references for integer in Java. But "int" not only does not work, it also prevents reading X and Y coordinates of the mouse. What i would like to do: 1) Get X and Y mouse coordinates into a variable that i can do real math on. So far, i can do math on the values "read" and that result goes into a "variable" that is useful *only* for display. If i try "int" in that math, the values are then zero for everything...
7
1541
by: GS | last post by:
we are using the following script for cursor to goto default position, is this script is java script or not?. can somebody tell me. I got this script from Internet, our client told us not to use any Java script to set the cursor to default position. Thanks in advance. onload="document.login.userrname.focus();"
24
4123
jeffbroodwar
by: jeffbroodwar | last post by:
Hi everyone, Please help me accomplish the following : 1. how can i copy a file in java then paste it in a desired location 2. how can i run a .jar file run by just double clicking on it.... I need to know the answer asap... please reply asap... thanks.
2
5088
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!! <!--put the preloads file here as it must load before the website class...
5
3780
by: usha535140 | last post by:
Hi, In the intial page I want to dispay a check box ie for the first time I should display the page with check box ,If the check box is checked i need to dispaly the tabcontainer with the tabs.If it is unchecked It should nt display any thing. I tried the following apporach : in aspx page for all the tabs of the container I used Enabled="false" later in the java script method I used set_Enabled(true) for all the tabs, with this am...
0
9589
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, 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...
0
9423
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,...
0
10214
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, 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...
0
10048
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8872
agi2029
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...
1
7410
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 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...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.