• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

call javascript function from external JS file

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...!!!
 
I didn't say it. I'm just telling you what this tiny ad said.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic