zarniwoop Posted June 23, 2010 Share Posted June 23, 2010 OK so I want to have a page that links to information on 2-8 different pages so I created an array: menuURL=new Array; menuURL[0]="https://www.neowin.net/"; menuURL[1]="http://www.google.com"; menuURL[2]="http://espn.go.com"; function Page(which){ location.href=menuURL[which]; } How would I express in HTML a link to https://www.neowin.net/news/tags/software/ using the variable menuURL[0]? Thanks for any help you can give me :) Link to comment Share on other sites More sharing options...
0 sweetsam Posted June 23, 2010 Share Posted June 23, 2010 Create a select menu with the various pages as options. Then monitor changes to the select element. When there is a change collect the active option and redirect the page to the link corresponding to the option selected using location.href. Hope that helps. Link to comment Share on other sites More sharing options...
0 Hot Posted June 23, 2010 Share Posted June 23, 2010 I am not exactly sure what you are asking but here is a link that uses a variable, as you said in your post, as well as concatenation, as you've said in your title. <a href="#" onclick="window.location = menuURL[0] + 'news/tags/software';">My Link</a> Link to comment Share on other sites More sharing options...
0 zarniwoop Posted June 24, 2010 Author Share Posted June 24, 2010 That worked PERFECTLY! Thanks Hot!!! Link to comment Share on other sites More sharing options...
Question
zarniwoop
OK so I want to have a page that links to information on 2-8 different pages so I created an array:
menuURL=new Array; menuURL[0]="https://www.neowin.net/"; menuURL[1]="http://www.google.com"; menuURL[2]="http://espn.go.com"; function Page(which){ location.href=menuURL[which]; }How would I express in HTML a link to
using the variable menuURL[0]?
Thanks for any help you can give me :)
Link to comment
Share on other sites
3 answers to this question
Recommended Posts