How can we return a value from User Defined Function ? For
Eg. we have 2 functions. In Fun1 i am getting 2 values (a,b)
and i am addding those 2 and storing in to another var (c).
Now i want to pass that var(c) to another function (fun2).
What will be the script?
Answers were Sorted based on User's Feedback
Hi Ganesh,
I will try for this. Thank u for sending responce once
again.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ganesh
<script language="javascript">
function add()
{
var a=parseInt(document.getElementById('x').value);
var b=parseInt(document.getElementById('y').value);
var c= a + b;
fun(c);
}
function fun(disp)
{
alert(disp);
}
</script>
</head>
<body>
Enter First Number:<input type="text" id="x" /><br />
Enter Second Number:<input type="text" id="y" /><br />
<input type="button" value="Add" onclick="add()" />
</body>
Am i right ??
Is This Answer Correct ? | 1 Yes | 1 No |
I don't think so Ganesh because, The same i said in the
interview, then the Interviewr said it is wrong we can not
decalre the function directly like function fun(disp).
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ganesh
Hi Mr. Krishna,
I worked on this code.
its working right ??
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ramesh
Hi Ganesh/Krishna,
Can you try it out the below one.
function add(out c)
{
c=a+b
add(c)
}
dis=add(c)
function len(dis)
{
count=length(dis)
}
Is This Answer Correct ? | 0 Yes | 1 No |
In sap script, created 1 form but when its went to production system , client want some changes in 1 (ex - addrss) window, what we will do?
Need a batch file or VB script to delete old (more than 90datys) roaming profiles
Someone who protect my excel file, m using ms office 2007 and windows 7 operating system, pls help me, how can i unprotect sheet
We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?
Why we use Action Script(Multimedia Flash) rather than using other scripting languages (JAVA,VB...etc) ?
why script is client dependant.
What are the advantages and disadvantages of Descriptive programing and Object repository in QTP??
can I name the build.xml with any name? if so how can I invoke ?
QTP not able to select multiple row selection when new rows are added
a="10.20.30.1" replace 1 with 45 in python using reg ex
How can you convert QTP 8.2 scripts to QTP 9.2. Please give some inputs ASAP.
In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?