![]() |
Link in array list
Hi, i want to put a link in the last option of this select list(the array element, like Cádiz, Córdoba,etc), depending of the option the link must be diferent, the problem is i have no idea how to do that i'm a noob in javascript topic.
Here´s an example of my list: Javascript: Code:
<script languaje="JavaScript">Code:
<form method="POST">PD: sorry for my bad english |
Quote:
This is my best guess as to what you are trying to do. Note: I have only populated the second (D2) select list with some dummy links. You will need to provide your own to get it to go where you desire. Code:
<!DOCTYPE html> |
Thank you so much, thats what i was talking about...just another question...is there anyway to generate the link taking the first and the second option with a base url, this is what i mean:
baseurl+option1+option2.html something like that?? i'm new in this stuff acctually i don't know anything, but i like to take a look and see how the code works (or at least the mayor part of the code jeje). Thank you. |
Quote:
Code:
function linkToSite(formulario) {Note: for consistency, you could change array assignment to: Code:
var provincias = []; |
Thank you so much :thumbsup:
|
Quote:
Happy to help. Good Luck! :) |
Can you post the complete code with the minor changes? The first time it works but just 1 time, i think i made the changes in the wrong part or something...
Thank you so much again :) |
Quote:
It would be better if you posted the code you are using to see what it is that you are doing wrong. |
Ok, the problem is i don't have idea of where to place the minor changes in the post #4 ,that's why i'm asking you for the complete example code :confused:..... i'm using this one:
Code:
<!DOCTYPE html> |
The program will do very little for you until you fill in the appropriate links in the 'provincias' array.
In the following I have only set-up dummy choices for: 'Aragon' and 'Huesca' or 'Teruel' or 'Zaragoza' There are no other elements initialized. Their selection will only show a blank '-' alert Also, since they would link to different baseURL locations, I have left it defined as a blank because you have not provided it as requested. Finally, I have used an alert to display the link to show where it would go to. I do not go to it unless you uncomment the document.href.location = ???somewhere??? line. You have not provided me enough information to complete the project for you and my mind reading skills suck! Code:
<!DOCTYPE html> |
Sorry for the inconveniences :(, i will explain what i want to do the mos clearly i can.
I have the list with 2 options that take me to link i defined (the first code you provide me in the #2 post) and works fine, but what i'm asking for now is something like this: let's imagine i choose: Andalucia and then Almeria i want a base url to be the same to all the options no matter wich i choose, mmm like: www.webdeveloper.com but the link when i choose Almeria must take me to: www.webdeveloper.com/AndaluciaAlmeria.html BaseUrl+option1+option2 did i explain myself ok? hope this is clearly sorry my english is not that good...i will ask you for a complete code like the first one because if you indicate me the changes probably i will not be able to understand where to place it. and Again Thanks for all your help :) |
Be sure to change the 'baseURL' to your common site or you'll get a lot of 'file not found' errors.
Code:
<!DOCTYPE html>but not worth the effort if you are happy with the results. |
well, with that i need to add to every second option the word i want to add to the link...i was wondering if there's a way to add the actual option1 and option 2, not typing again option 2 like this:
Zaragoza|Zaragoza (if 'm right the bold one will be added to the base URL) But i want the option i choose adds to the baseurl to save me time typing because my list have like 30 options with 12 sub-options each one, that leaves me with 360 links (actually each one will search for a file to download). For some reason the code only adds the option2 value to the base URL, again thank you very much for your time you're a Master :thumbsup: |
Code:
<!DOCTYPE html>Quote:
|
sorry, i check it again and it works fine, i don't know why it wasn't working, my mistake, thank you for all your help i think i solve my problem with your help, now i just need to modify the code because i need some lists without sub-options just and array with one list and baseUrl, i hope i can do that because i have no idea of how to create an alone array in javascript XD, have a good day and thanks for all :)
Update: damn i can't get rid of one list, i only want a simple list with BaseUrl+option1 (with out option 2 list) but i can't i'm not that good with codes :/ hope you can help me...again... |
| All times are GMT +1. The time now is 05:20 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.