0
   

how call an inner function in javascript

 
 
Reply Mon 10 Dec, 2012 10:33 am
i have an inner function and i call it with setTimeout.
i call it like this

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript">

function Overrideablefunc() {

this.runfunc=function () {
document.getElementById('txt').value = Date().substring(0, 24);
//***************************************
var overrd = new Overrideablefunc()
setTimeout(overrd.runfunc, 1000);
//***************************************

}
}

function runnewfunc() {
var a=new Overrideablefunc()
a.runfunc();
}

</script>

</head>
<body>
<input type="button" value="Run" onclick="runnewfunc()"/><br />
<input type="text" id="txt" style="width:400px"/>
</body>
</html>

i call my function with

//***************************************
var overrd = new Overrideablefunc()
setTimeout(overrd.runfunc, 1000);
//***************************************

but i don't know this way is right or not?
thank you
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 772 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » how call an inner function in javascript
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/14/2025 at 07:19:41