Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


sarika
check where is error
1 Answer(s)      6 years ago
Posted in : JSP-Interview Questions



Advertisement
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
check
updated"); will the above code check if the user has entered value for empcode
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
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
check for errors
check for errors  How can I check for errors
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
password check
password check  how to check sighup passowrd and login password
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 anagram
check anagram   compare two input is anagram or not but input contains million words
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
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
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
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
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
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
"+it); } } this is my program i am getting an error saying cannot find symbol class string
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
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
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
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
click on check box
click on check box  I create a check box in HTML and when i click on my check box relative information in page store in database
how to insert check box
how to insert check box   how to insert check box into jtable row in swing
check box left justification
check box left justification  how to make a check box left justification which is at right end? thanks in advance
To check a palindrome number?
To check a palindrome number?  program to check a number is palindrome or not using recursion?(wihout converting to string
Help for Check availability of user
Help for Check availability of user  I need the code for check availability of users in the database before login.I placed a button for Check Availability.Can it be done with this or ajax should be used
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
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
What is CHECK Constraint?
What is CHECK Constraint?  What is CHECK Constraint?   Hi, The CHECK constraint is used to limit the value range that can be placed in a column.The SQL CHECK constraint ensures that all values in a column satisfy
check box in jsp
check box in jsp  hey guys i am working on a web based project using jsp. In my project 1 am having 9 check boxes in 3 rows in the same form. I want to select 1 check box from each row and also i want to avoid many check box
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
check condition in if-else block
check condition in if-else block  Hi, I want to update database with following query int i= st.executeUpdate("Insert into text_editor(words) values('"+words+"')"); how can I give a check option so only valid words are inserted
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
Hi Check this.... - Java Beginners
Hi Check this....  Hi Sakthi here.. Run This Code..   Hi sakthi Your code is not visible here, can u send again please.. Thanks
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
To check the Rotational Strings are Equall or not
To check the Rotational Strings are Equall or not  I attended 3dplm software company interview....there asked one question related to Strings.The question is................. Write a program to check the given two strings
 

 

 

DMCA.com