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

The error is Object expected

Hi all.

Why this script not working?

The error is Object expected in the line:

var new_ = concat(concat(ore,":"), min);

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <script>
  5.  
  6. function insertColon(id){
  7. var stringa = document.getElementById(id).value;
  8. var ore = stringa.substr(0,2);
  9. var min = stringa.substr(2,2);
  10.  
  11. var new_ = concat(concat(ore,":"), min);
  12.  
  13. document.getElementById(id).value = new_;
  14. }
  15. </script>
  16. </head>
  17.  
  18. <body>
  19.  
  20. <input id="testo" type="text" name="ora" size="5" onchange="java-script:insertColon('testo')"/>
  21.  
  22. </body>
  23.  
  24. </html>
Can you help me?
Jul 4 '08 #1
5 1728
acoder
16,027 Expert Mod 8TB
Get rid of "java-script:" - you don't need it and even if you were to use it, it would be "javascript".

Where is concat defined?
Jul 4 '08 #2
thanks acoder x your reply, but error of copy/paste.

The error is same.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <script>
  5.  
  6. function insertColon(id){
  7. var stringa = document.getElementById(id).value;
  8. var ore = stringa.substr(0,2);
  9. var min = stringa.substr(2,2);
  10.  
  11. var new_ = concat(concat(ore,":"), min);
  12.  
  13. document.getElementById(id).value = new_;
  14. }
  15. </script>
  16. </head>
  17.  
  18. <body>
  19.  
  20. <input id="testo" type="text" name="ora" size="5" onchange="javascript:insertColon('testo')"/>
  21.  
  22. </body>
  23.  
  24. </html>
Jul 4 '08 #3
acoder
16,027 Expert Mod 8TB
concat is not defined. Did you mean to use the String object's concat() method?
Jul 4 '08 #4
Concat is for joining arrays.

Its working now, many thanks.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <script>
  5.  
  6. function insertColon(id){
  7.     var stringa = document.getElementById(id).value;
  8.     var ore = stringa.substr(0,2);
  9.     var min = stringa.substr(2,2);
  10.  
  11.     var new_ = ore + ":" + min;
  12.     document.getElementById(id).value = new_;
  13. }
  14. </script>
  15. </head>
  16.  
  17. <body>
  18.  
  19. <input id="testo" type="text" name="ora" size="25" onchange="javascript:insertColon('testo')"/>
  20.  
  21. </body>
  22.  
  23. </html>
  24.  
Jul 4 '08 #5
acoder
16,027 Expert Mod 8TB
...and for strings, e.g.
Expand|Select|Wrap|Line Numbers
  1. var new_ = ore.concat(":",min);
Anyway, glad it's working.
Jul 4 '08 #6

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

Similar topics

5
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. ...
1
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...
1
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...
0
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)...
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...
6
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. ...
1
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...
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="<%=...
2
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. ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...

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.