piratpl
05-18-2010, 06:51 PM
I'm trying to call a function located in another file. Than use the return value in the original file. I'm new to java scripting any help is appreciated.
// This is the content of page.html
<input type="text" name="text_filed" id="text_field_id" onClick="return false;" onBlur="isit('text_field_id');return true;"/>
<script type="text/javascript">
function isit(id){
inputval=document.getElementById(id).value;
expectedval=compare(inputval).src='/check.js';
alert(expectedval);
</script>
//This is the content of check.js page
function compare(inputvalue)
{
//do some calculation and return value
return value;
}
I know there is a problem with how I'm calling the compare() function. Can someone advise the right syntax to do this. Thanks!
// This is the content of page.html
<input type="text" name="text_filed" id="text_field_id" onClick="return false;" onBlur="isit('text_field_id');return true;"/>
<script type="text/javascript">
function isit(id){
inputval=document.getElementById(id).value;
expectedval=compare(inputval).src='/check.js';
alert(expectedval);
</script>
//This is the content of check.js page
function compare(inputvalue)
{
//do some calculation and return value
return value;
}
I know there is a problem with how I'm calling the compare() function. Can someone advise the right syntax to do this. Thanks!