check where is error

check where is error

View Answers

October 1, 2008 at 12:45 PM

Hi friend,


We test and run the program having error of it always come in the "else"
condition due to white space problem.
This problem remove to use trim function in javascript.

function trim(value) {
var temp = value;
var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
var obj = / /g;
while (temp.match(obj)) { temp = temp.replace(obj, " "); }
return temp;
}

correct code :

<html>
<head>
<title>javscsript program</title>
<script type="text/javascript" language="javascript">
function trim(value) {
var temp = value;
var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
var obj = / /g;
while (temp.match(obj)) { temp = temp.replace(obj, " "); }
return temp;
}
function palindrome()
{
var string=document.f.text.value;
document.f.reverse.value=reverse(string);

alert(string);
alert(reverse(string));

if(trim(string) == trim(reverse(string)))
{
alert("this is djfksjfja palindrome");
}
else
{
alert("this is not a palindrome");
}
}
function reverse(ss)
{
var len=ss.length;
var rev=" ";
for(var i=len; i>=0; i--)
{
var rev= rev+ss.charAt(i);
}
return rev;
}

</script>
</head>
<body>
<form name="f">
Enter string to be Reversed : <input type="text" name="text"><br>
<input type="button" onClick="palindrome(); " value="submit "><br>
Reversed String is : <input type="text" name="reverse">
</form>
</body>

</html>

If you have any more problem then explain in details.

Thanks









Related Tutorials/Questions & Answers:
check where is error - JSP-Interview Questions
check where is error  hi deepak i have made a program in javascript but it is not working properly will u plz tell me where is error in my program... is :   Hi friend, We test and run the program having error
ModuleNotFoundError: No module named 'bcx-error-check'
ModuleNotFoundError: No module named 'bcx-error-check'  Hi, My... named 'bcx-error-check' How to remove the ModuleNotFoundError: No module named 'bcx-error-check' error? Thanks   Hi, In your python
Advertisements
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
i got illegal start of expression error , plese tell me the mistake where i did...
i got illegal start of expression error , plese tell me the mistake where i did...   import org.springframework.context.*; import java.util.*; public class MyListener implements ApplicationListener { public static void main
check
updated"); will the above code check if the user has entered value for empcode
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern = /^\d{3,5
error
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
error
error  whats the error.............. import java.util.Scanner; public class g { public static void main(String[] args) { Scanner s=new Scanner(System.in); int d,x,y; System.out.println("Enter the first number
Where clause
Where clause  I have doubt in Where clause .. i got a Employid from user and check the id and display the details of that id what can i do?   The WHERE clause is used to filter records.It is used to extract only those
ModuleNotFoundError: No module named 'where-to'
library, ModuleNotFoundError: No module named 'where-to' error...ModuleNotFoundError: No module named 'where-to'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'where'
ModuleNotFoundError: No module named 'where'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'where..., ModuleNotFoundError: No module named 'where' error will be solved. Thanks
ModuleNotFoundError: No module named 'where-to'
library, ModuleNotFoundError: No module named 'where-to' error...ModuleNotFoundError: No module named 'where-to'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
XML Error Checking and Locating
XML Error Checking and Locating       In this section, you will learn how to check and locate an error in the XML document and error position.  Description of program:ADS
where to stroe this uploaded file
where to stroe this uploaded file  thank your sir, but where this file is stored? and how to get the path for further use
where this file is stored
where this file is stored  thank your sir, but where this file is stored? and how to get the path for further use
Where to update the Hibernate tools?
Where to update the Hibernate tools?  Hi, What is the url to to update the hibernate tool in eclipse? Thanks   Hi, Hi if you are using the hibernate tool you can update it. Check Check the tutorial Hibernate tools
Where to implement spring - Spring
Where to implement spring   Hi, Where we implement spring framework in j2ee appplication. I mean which layer .Thanks
Where to stay in Delhi?
Where to stay in Delhi?  Hi, i am visiting New Delhi in the mid of june ...so, just wondering where to stay? Is there an cheap as well as best place or hotel where i can stay for couple of day's
Where is my.cnf in linux?
Where is my.cnf in linux?  Hi, Can anyone tell me where is my.cnf in linux? Thanks   Hi, Its is /etc folder. The complete path with file name is /etc/my.cnf. Thanks
XML Error checker and locater (DOM)
XML Error checker and locater (DOM)       In this section, you will learn to check and locate (line and column number) an error in your XML document using the DOM APIs
check for errors
check for errors  How can I check for errors
where to start - Java Beginners
where to start  Myself being a java beginner want to know wat... from http://www.roseindia.net/java/learn-java-in-a-day/index.shtml Check... You can master Java in a week. Please check our section http
password check
password check  how to check sighup passowrd and login password
check anagram
check anagram   compare two input is anagram or not but input contains million words
where the progrming is done in the struts.
where the progrming is done in the struts.  where the progrming is done in the struts.   Hi Friend, You can use EditPlus, Eclipse or NetBeans IDE. For more information, visit the following link: Struts Tutorials
Where and Having clause
Where and Having clause   hii, What is the difference between where and having clause?   hello,ADS_TO_REPLACE_1 WHERE clause is used to impose condition on SELECT statement as well as single row function and is used
where clause in select statement
where clause in select statement  In Mysql,I write the following query: select * from emp where designation = "MANAGER" But the actual value... nly if the where condition is "manager" and not "MANAGER
Where clause with query in MySQL
Where clause with query in MySQL  Hi, I want to learn the where... is the various example of where clause: Suppose we have following table: mysql> select... record: select * from email where first_name='deepak'; Here is the output
Mysql Where
Mysql Where       Mysql Where returns only those records from table which are specified in the WHERE Clause. The Where Clause restricts the select query and shows you only
Where to learn Struts 2?
Where to learn Struts 2?  Hi, I am beginner in Struts and trying to find good tutorial to learn Struts 2 framework. My project is in Struts 2 and soon I have to work on the project. Let's know where to learn the Struts 2
Mysql where
Mysql where       Mysql Where is used to return the select records based on the condition specified in Where CLAUSE. Understand with ExampleADS
Interview Questions - Where Java is used?
applications Java mobile applications For Creating Applets Check: Where is Java...Interview Questions - Where Java is used?  Hello, Where Java is used? Thanks   Hi, Java is used for creating various types
Where is Python used?
Where is Python used?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Where is Python... the topic "Where is Python used?". Also tell me which is the good
javascript where to declare variables
javascript where to declare variables  javascript where to declare variables   Javascript variable always be declared inside script tag... variables in Javascript   JavaScript where to declare variables To declare
JavaScript where to place in HTML
JavaScript where to place in HTML   Where to place JavaScript code into HTML Code?   Placing JavaScript code into HTML Code In HTML, JavaScript can be declared anywhere either in <Head>? or <Body>? Tag

Ads