Hi. Sorry but I am a non-techie person, so forgive me with the bad description I am about to begin.... I have a network of sites. And each time I add a new one, I have to go through each site and add the link for use with the drop down menu. I would like to make a list on the main site and then on each network site use some js code to call that list on the main site. Thus only having to add the new sites onto one file instead of many and many. Thanks to anyone that can direct me to this!
It depends on what sort of drop down menu you use. If it reads the links from an javascript array, then it's easy. Just make an "links.js" file on your main website, with the array of links, and include that file on all the other sites with <script src="http://www.your_main_site.com/links.js"></script>
Hi, I would need to create an array as this is just using a form -- how would i do that (create the array) <form name="guideform" id="guideform" action="#"> <select name="guidelinks" id="guidelinks" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> Code (markup):
I have come across this.... How would I name the code so I could call it from other websites (like stated in bibel post). This is the code for the form <form name="Form1"> <br / name="selURL" onChange="NavTo(selURL)" style="width:200px"> <option selected value="0"> --Select--</option> <option value="http://www.SwansonSoftware.com">SwansonSoftware</option> <option value="http://www.google.com">Google</option> </br /> </form> Here is the Javascript <script language="JavaScript" type="text/javascript"> <!-- function NavTo(sel) { var myindex=sel.selectedIndex if (myindex != 0){ location=sel.options[myindex].value; } } // --> </script> Code (markup):
Now it's more clear what you want. There' no need for that code you posted. In onchange just add "if(this.value){window.location=this.value}". As for filling the options from a script from another site, with this method it's a bit more complicated. An easy way would be to put your entire combo in a file on the main website, say http://www.your_main_website.com/links_list.html In that file put this : <select name="selURL" onChange="NavTo(selURL)" style="width:200px"> <option selected value="0"> --Select--</option> <option value="http://www.SwansonSoftware.com">SwansonSoftware</option> <option value="http://www.google.com">Google</option> </select> (I'll presume that <br in your code is a typo ) Next, in your other websites you can get that select with : $combo=file_get_contents("http://www.your_main_website.com/links_list.html"); and then echo $combo, wherever you want your links
Going to give it a whirl The br was just a copy and paste....so... When you say echo I add "echo $combo" where I want the box to be?