473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to pass the value from the js to another js

kaleeswaran
132 100+
hi!
how to pass the value from one javascript to another...both are being in different file...
thank you,,,
i can get an alert from the respective function ...but i don't how to get the value...
Eg:
a.js:

Expand|Select|Wrap|Line Numbers
  1. function s() {
  2.     alert('SAMPLE');
  3. }
b.js:

Expand|Select|Wrap|Line Numbers
  1. function w() {
  2.     s();
  3. }
  4.  
can get the alert but i don't how to get the value from s function.
Nov 20 '07 #1
8 7688
andho
34
what value do you mean? more details will be good.
Nov 20 '07 #2
gits
5,390 Expert Mod 4TB
hi ...

have a look at the following example:

Expand|Select|Wrap|Line Numbers
  1. function s() {
  2.     var value = 'SAMPLE';
  3.     alert('here is func s with local var: ' + value);
  4.     return value;
  5. }
  6.  
  7. function w() {
  8.     var v = s();
  9.     alert('here is func w called with the returned: ' + v);
  10. }
  11.  
  12. w();
  13.  
kind regards
Nov 20 '07 #3
kaleeswaran
132 100+
yes thank you, but both files are in different folder,,,
how can i do this?...
thank you,
kaleeswaran
Nov 20 '07 #4
gits
5,390 Expert Mod 4TB
different folder? ... to get it to work you have to include the files in a webpage ... and then you don't have a problem ... is it a webpage where you want to use the functions? only one or different frames?
Nov 20 '07 #5
kaleeswaran
132 100+
hi,

I am using a jsp page which has script in it .. I want to pass value from this jsp page to another js file. both are in different folders

I have a hidden variable in the jsp page i want to get this value in the js file,


Regards
Kaleeswaran
Nov 20 '07 #6
gits
5,390 Expert Mod 4TB
hmmm ... how is the interaction of the scripts? let me summarize: you request a jsp-page from the browser -> the user gets the html and works with the page -> a value of a hidden field is set on the page -> now that value should be passed to another page with another script?
Nov 20 '07 #7
kaleeswaran
132 100+
Hi,
thanks for the reply
Its not another page with script but another script file (js file).
what i did is that we got the value of the hidden field into the script in the jsp page but now i cant pass this value to the script file.

can you tell me how to return a value from a function
Nov 20 '07 #8
acoder
16,027 Expert Mod 8TB
Can you show how you include these scripts within the page and what they contain?
Nov 21 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: vishal | last post by:
hi i am using get method to pass data from one form to another and my value may contain & symbol. so when this is case the value after & sign is truncated which is logically true. so what...
11
by: Vanessa | last post by:
Hi, I would like to know whether there's any way for me to pass an object by reference to another form? Regards Vanessa
4
by: z_learning_tester | last post by:
I'm reading the MS press C# book and there seems to be a contradiction. Please tell me which one is correct, 1 or 2. Thanks! Jeff 1. First it gives the code below saying that it prints 0 then...
4
by: tom | last post by:
Hi Experts, I want to pass the selectedDate value from my calender form to another web form or a web user control. Could you please show me how to do this? Thanks in advance.
3
by: Naseem | last post by:
I am using CR in ASP.NET , I am able to show drill down graphs where grouping is done on single column from result set of sql query, is it possible to achieve drill down by grouping on multiple...
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
11
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible...
17
by: akshay01 | last post by:
Hi all, I am retrieving some rows from DataBase using for loop in jsp and displaying it in a table format.In the output table I am also adding one more text box and checkbok with each row. In text...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.