View Full Version : call a function

01-24-2012, 10:50 PM
Hello, if in a webpage is included a javascript file (for example code.js) can I from my browser call a function contained in code.js and will it works correctly?
I'm not meaning that the function is called in the page with or without a link to click, but it is only in code.js!

Thank you!

Old Pedant
01-24-2012, 11:17 PM
You mean you want to call it from the address bar of the browser??

01-25-2012, 12:48 AM
You mean you want to call it from the address bar of the browser??
Not compulsorily on the address bar, just know if it is possible and there is a method to do that...

Old Pedant
01-25-2012, 07:06 AM
I'm lost.

If you don't care about doing it from the address bar, then the only other way is to have code in that HTML page that calls it. Which you certainly can do. But I don't feel that's what you mean.

01-25-2012, 08:11 AM
Do you mean onload?

02-05-2012, 06:39 PM
I mean a page includes fun.js and inside fun.js there is a function that do something but it isn't called in the page.
Can I call it from my browser and it will work?


02-05-2012, 08:46 PM
So you are saying that in your JS file there are say two functions, yet your HTML file only calls one of the functions but you want the 2nd function to be ran as well but not from code that is in the HTML file.

I'm sure that you can get a 2nd HTML file to run the 2nd function in your JS file.

02-06-2012, 02:10 AM
You should be able to call that function either from the address bar or from any JavaScript you have attached to the browser yourself.