• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

call javascript function from external JS file

 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have three combo boxes and the selection of the 1st one changes the data in the second and thrid combo box. I'm doing this right now, by calling the refresh javascript on the onChange event of the combo box.
But i no longer like the refreshing of the page, so i thought it would be best if i could write a code, to generate the Javascript that i require, and call it on the onChange event of the combo box.
After searching this forum, i got this link which helped me in populating dynamic data through javascript. I'm pasting the code below:



I know how to write a class file to generate the JS file, but i don't know how to call it from the onChange event of the combo box.
In this case, calling the redirect method from the onChange event of the first combo box from the external JS file.
Can plz some one guide me as to how i should call the external JS file from the onChange event of the first combo box to populate data in the second combo box.

Thanxs in advance.
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have posted the javascript in the external file, and called it
<script lanaguage="javascript" src="dynamic.js">
</script>

and its working absolutely fine...

bye.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know how to write a class file to generate the JS file


What does this mean? JavaScript does not have classes, and an external JS file does not need to be generated, it needs to be written and put in a directory from where it can be included in the current page.

how i should call the external JS file


A file is not called, it is included in a page via the script tag. Then you can call any functions that are declared in it.
 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ulf Dittmer ,


What does this mean? JavaScript does not have classes, and an external JS file does not need to be generated, it needs to be written and put in a directory from where it can be included in the current page.



I don't want my JS file to be static, that's why i'm going to write a java program that will generate the JS file with the appropriate code and put it in the appropraite directory location.
So i don't want to manually append the Js file, rather i will run my java program to append the JS file.


A file is not called, it is included in a page via the script tag. Then you can call any functions that are declared in it.


Yes, i understood that, and that can be seen in my second reply itself.

Hope i've made myself clear now...!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic