retro-starr Posted December 22, 2010 Share Posted December 22, 2010 Is there a way to use another function from inside a different function? Below, I had homepage() use the window.open() command, but when I changed the name of the iframe, I forgot about there was two places that needed the name change as well. It frustrated me for hours, so I want to see if there is a way to simplify this. This would also be helpful when I make a function for the URL schemes; right now, without the http, the script looks for a file. function homepage(){ // get the homepage variable the user set -- not yet implemented //window.open('http://www.google.com', 'iframe_content', 'status=yes').location.href; address_bar('www.google.com');}// address bar + go button// mod code from: [url="http://www.javascriptfreecode.com/83.htm"]http://www.javascriptfreecode.com/83.htm[/url]function address_bar(variable){ var site = variable; if (site != "") { var site = "http://" + site; } window.open(site, "iframe_content", "status=yes").location.href; // get the URL of the current page -- isn't aware of the iframe pages variable = document.write(document.URL);} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.