sarika
check where is error
1 Answer(s)      4 years and 8 months ago
Posted in : JSP-Interview Questions

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 Pages:
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
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
Mysql Check
Mysql Check       Mysql Check is used to check the existence of table in the database. Understand with Example The Tutorial illustrate an example from 'Mysql Check
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. This type error also comes when java file
check null exception java
this error. The only way to handle this error is validation. You need to check...check null exception java  check null exception java - How to check the null exception on Java?   The null pointer exception in java occurs
check youtube iframe code
check youtube iframe code  I have a piece of code that checks...: //Check Embed Code $embedCode = $postData['embedCode... { $mainframe->enqueueMessage(JText::_('EMBED CODE ERROR
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
How to check a checkbox - Struts
How to check a checkbox  Hello Community, How can i check a checkbox defined with tags. with plain html, the tag checks the box. with the other tags i am getting an error that the property "checked" is not defined. Can someone
Dynamic check box problem
Dynamic check box problem  In my project i have used a dynamic table, in the each row of that table there is one check box [that i have created... check boxes ... pleas help me as soon as possible...   1)application.jsp
check
updated"); will the above code check if the user has entered value for empcode
CRC(cyclic redundancy check) - UML
CRC(cyclic redundancy check)  write a program that accepts a data sequence , generates a fcs (using a known divisor) and then ultimately check whether the recieved data is in error
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
jsp error - JSP-Servlet
could not be made at all. Check your directory structure where you save..., The 404 or Not Found error message is an HTTP standard response code indicating
What is the error in this coding?
What is the error in this coding?  <% Class.forName...=Conn.prepareStatement("SELECT NAME FROM LOGINDETAILS WHERE LOGIN ID='"+Loginname...(); if(name != null) out.println("Welcome to "+login); else out.println("Please check
Check Properties
Check Properties       This example illustrates how to check properties using.... The following example shows how to check whether TOMCAT_HOME environment
Error in a code. - Java Beginners
Error in a code.  This is the question I posted yesterday: "I'm.... I'm confused about where and what i should put into the overall code. Also I can't... the number to check. Once the user gives a choice, then use the Primes class
PHP SQL Where
PHP SQL Where       PHP SQL Where is used to modify or change the structure of  table definition based on the condition specified in Where Clause. The PHP SQL Where allows
Programming Error - JSP-Servlet
further then when it check the chekbox ie confirm then only the data should get displayed in next page where he will review his ad . I want that when user type... this is done user should check the confirm button and the review will get displayed
SQL PHP Where
SQL PHP Where       SQL PHP Where is used to built the connection between the SQL and PHP... illustrate an example from 'SQL PHP Where'. To understand and illustrate
error in web application
error in web application  In your application when i am trying... where id="+id; System.out.println("query " + query...; We are providing you another application. Check it. 1)application.jsp
Php Sql Where
Php Sql Where This example illustrates how to use the WHERE clause in the UPDATE query in PHP. In this example we create a UPDATE query with WHERE clause to update the field emp_name where name is 'amar'. In the figure below the first
Java compilation error - JSP-Servlet
jsp running on Apache Tomcat, where the report creator will have file attachment... to my problem, but having some error as below.. Generated servlet error: C...; ^ Generated servlet error: C:\Program Files\Apache Software Foundation
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
PHP SQL Select Where
PHP SQL Select Where       PHP SQL Select Where is used to provide the records from the table that meet the specific criteria and print the records on the browser. The Where Clause
Mysql PHP Where
Mysql PHP Where       Mysql PHP Where is used to insert the records from database and print... The Tutorial illustrate an example from 'Mysql PHP Where'. To understand and grasp
Using WHERE Clause in JDBC
Using WHERE Clause in JDBC    Where... conditions. It allows to filter the data from a table, a WHERE clause can be added to the SELECT statement. The WHERE clause searches the specific results
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.
page from where the login authentication has taken place.  I am...;The given code accepts username and password from the user and check whether the user...=st.executeQuery("select * from login where username='"+user+"' and password='"+pass+"'"); int
Retrieve data from databse using where in JSP
help me. ALL DATABASE CONNECTIONS ARE OK. THE ERROR IS SHOWN IN "WHERE". IT SAYS...Retrieve data from databse using where in JSP  Hi, can somebody help me? I have a jsp page. in that i want to get data from the database where
JSP check email exists or not
JSP check email exists or not In this tutorial, you will learn how to check... accepts the email id from the user and check whether the given email id already...;text/javascript"> function check(value){ xmlHttp=GetXmlHttpObject
PHP SQL Query Where Clause
PHP SQL Query Where Clause     ... query with where clause. To understand how to display the result returned ..._error());   mysql_select_db("test") or die(mysql
Check Perfect Number in Java Program
How to Check Perfect Number in Java Program A perfect number is a positive integer where the sum of all its positive divisors, except itself, is equal to the number itself. For example 6 is a perfect number as 1,2 and3 are its divisors
Please check it and let me know - Java Beginners
Please check it and let me know  Hi friends, your las suggession is not ok becoz this code give some error and problem,Today i m sending all code and requirement please check it and solve again thanks Requirements:- I
Jcommon error
the code for bar chart and pie chart where this error will not come. and also...Jcommon error  hi................. what u had said i have downloaded the jar file the latest one then also its giving me same error can u tel me why
Error during runtime NoClassDefFound in java
Error during runtime NoClassDefFound in java  code: package Jama...; If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is diagonal... check iteration count here.) // Compute implicit shift
Error during runtime NoClassDefFound in java
Error during runtime NoClassDefFound in java  code: package Jama...; If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is diagonal... check iteration count here.) // Compute implicit shift
servlet-error
servlet-error  where we declare a servlet errors in web application
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: The following
Syntax error in my UPDATE..please advise
Syntax error in my UPDATE..please advise  Hi experts, I tested my code and NetBean IDE gave me the following message:- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
Check PHP MySQL Connectivity
Check PHP MySQL Connectivity: The first step of any kind of connectivity is to check whether the connectivity has been established or not. To check... you to check whether your PHP web page has been connected with MySQL server
annotation error
annotation error  class names "JdbcProjam.java "are only accepted if annotation processing is explicitly requested   Is your class name is JdbcProjam or JdbcProgram? Check it properly. Java is case sensitive. So use
error at programming
error at programming  <p>import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*;</p> <p>... login where uname='"+user+"' and password='"+pass+"'"); int count=0
Can u Look to the error plz - Java Beginners
;where is the answer sir.? just i want from you to look what is the error plz...Can u Look to the error plz  this is my code can u modify it plz and give me the result of it when u check it on eclipse or jcreator plz and i
check for errors
check for errors  How can I check for errors
Java Error In comapitable Type in statement - Java Beginners
Java Error In comapitable Type in statement  Here I want to Check... faculty where id like '"+'%'+ide+'%'+"'"); if(rs.next...(j1,"Error in submitting data!"); }//end catch }// end Action
how to check dates while retrieving data from database
how to check dates while retrieving data from database  i want to update database record based on delivery date i have tried this query but it wont...]+"',bqty='"+arr1[3]+"' where dno="+k1+" and ddt="+k+""; int exe
javascript programing error - JSP-Servlet
javascript programing error  hi deepak i m using explorer to run javascript program in this there is no option to check error will u plz tell me the way to check error in explorer as we can check with mozila
ERRor in executing DB program
an error in your SQL syntax; check the manual that corresponds to your MySQL server...ERRor in executing DB program  While executing following code an Error was generated.can any one help me for this. LiveDB liveDBObj
password check
password check  how to check sighup passowrd and login password
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
JFREE error again
JFREE error again  hi......... As i had asked u the jfree error i.... but then also its giving me error i am able to compile the code but now when i am... is the error which i am getting plz help to solve this error plz help

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.