codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  functions  judjud at 22:03 on Monday, February 07, 2005
 

I am trying to write a function that prints out input in reverse. say if I type in 731 it will print out 137. I am teaching myself Javascript and my code is not working Please help. This is my code

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<SCRIPT type = "text/JavaScript">
<!--
var entry;
entry = window.prompt("Enter a value:", "0");

var result = printit( entry);

window.status = "The number is " + result;

function printit ()
{
result = entry.reverse;
return result
}


// -->
</script>



</head>


</html>


  Here ur answer ........Check it baby  jask2002 at 04:56 on Wednesday, February 09, 2005
 

<html>
<head>
<SCRIPT type = "text/JavaScript">
<!--
var entry;
entry = window.prompt("Enter a value:", "0");

var result = printit( entry);

window.status = "The number is " + result;

function printit ()
{
var finalstr;
var str=entry.toString();
var myArray= new Array();

finalstr="";



for(i=0;i<str.length;i++)
{

//alert("str:" +eval(str.substr(i,1)));
myArray=str.substr(i,1);



}
myArray.reverse();

//print the result
for(k=0;k<myArray.length;k++)
{

finalstr = finalstr + myArray[k].toString() ;
//alert("finalstr"+finalstr);

}



result = finalstr;
return result
}
</script>

</head>
<title>Hello</title>
<body>
Check the status bar
</body>
</html>

  Here ur answer ........Check it baby  jask2002 at 04:56 on Wednesday, February 09, 2005
 

<html>
<head>
<SCRIPT type = "text/JavaScript">
<!--
var entry;
entry = window.prompt("Enter a value:", "0");

var result = printit( entry);

window.status = "The number is " + result;

function printit ()
{
var finalstr;
var str=entry.toString();
var myArray= new Array();

finalstr="";



for(i=0;i<str.length;i++)
{

//alert("str:" +eval(str.substr(i,1)));
myArray=str.substr(i,1);



}
myArray.reverse();

//print the result
for(k=0;k<myArray.length;k++)
{

finalstr = finalstr + myArray[k].toString() ;
//alert("finalstr"+finalstr);

}



result = finalstr;
return result
}
</script>

</head>
<title>Hello</title>
<body>
Check the status bar
</body>
</html>








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  How to dynamically create a calendar when I click a button?
•  c++ tutorials
•  Update a second table
•  Trackin Site behaviour
•  variable scope problem
•  dynamic crystal report generation
•  execute an Excel macro when the sheet is changed from ASP.NET
•  Re: form
•  form


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005