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 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?
what is the Structure of an ANT file?
how do u define in ur build.xml If I need to execute a task before executing my task?
why script is client dependant.
what is Eventflow.?
how can we move to the next column in excel sheet in file operation using descriptive programming inQTP?
How to double click on Simple HtmlText in SilkTest automation tool?
how do i compose the text message in the yahoomail using descriptive programming in QTP?
what is the diff between ANT and MAVEN?
Why we use Action Script(Multimedia Flash) rather than using other scripting languages (JAVA,VB...etc) ?
How to Communicate with JavaScript?
I have installed QTP version 9.0. I have installed Mozilla firefox version 2.0. But QTP "Record and Run settings" in WEB tab shows FIREFOX 1.5 in drop down to run session begins. So QTP does not record anything which I type in firefox. How can i recognise firefox 2.0 and how can i update browser version in QTP?