Dropdown boxes |
Author: |
Message: |
user27089
Disabled Account
Posts: 6321
Joined: Nov 2003
Status: Away
|
O.P. Dropdown boxes
OKay, I have the code sorted out for a dropdown box, but it doesn't change when I select them, I don't want a button, because it looks ugly, I would like the page to change when I select the certain item.
code: <p align="right">
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option style="color:gray;">Select your language here</option>
<option value="english/index.html">English</option>
</select>
</form>
</p>
|
|
03-14-2005 06:08 PM |
|
|
L. Coyote
Senior Member
Captain Obvious
Posts: 981 Reputation: 49
39 / /
Joined: Aug 2004
Status: Away
|
RE: Dropdown boxes
And what is the code for MM_jumpMenu()?
Something like this is often used to do that:
code: onchange="self.location=document.form1.menu1.options[this.selectedIndex].value;"
You can change self for the name of the frame/window.
Hack, hack, hack!
Finally became a Systems Analyst!
|
|
03-14-2005 06:24 PM |
|
|
Stigmata
Veteran Member
Posts: 3520 Reputation: 45
21 / /
Joined: Jul 2003
|
RE: Dropdown boxes
code: <script type="text/javascript">
function changelanguage(){
var selectedItem=document.form1.menu1.selectedIndex
document.mainframe.src = "http://http://mpsupport.killercarrot.co.uk/Language/" + selectedItem
}
</script>
<p align="right">
<form name="form1">
<select name="menu1" onChange="changelanguage()">
<option selected>English</option>
<option>Welsh</option>
</select>
</form>
</p>
so english would be 0, welsh 1, etc etc...
would it be that hard to ask me once in a while
This post was edited on 03-14-2005 at 06:29 PM by Stigmata.
|
|
03-14-2005 06:28 PM |
|
|
user27089
Disabled Account
Posts: 6321
Joined: Nov 2003
Status: Away
|
O.P. RE: Dropdown boxes
quote: Originally posted by Stigmata
would it be that hard to ask me once in a while
Sorry, I'm used to just posting on here .
Thanks for your help anyway . But, its not in a folder called languages, so that would make it void ... they're in seperate folders for each language...
|
|
03-14-2005 06:30 PM |
|
|
Stigmata
Veteran Member
Posts: 3520 Reputation: 45
21 / /
Joined: Jul 2003
|
RE: Dropdown boxes
well rename the language to numbers for simplicity
|
|
03-14-2005 06:33 PM |
|
|
user27089
Disabled Account
Posts: 6321
Joined: Nov 2003
Status: Away
|
O.P. RE: Dropdown boxes
hmm, so where do I add this, I really am not that good yet, so can I please have details on how to do it?
|
|
03-14-2005 07:18 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: Dropdown boxes
<html>
<head>
<title>blah</title>
<script type="text/javascript">
function changelanguage(fMenu) {
var iSelectedItem = fMenu.selectedIndex
var sLanguage = fMenu.options[iSelectedItem].value;
// If you're using frames (eg: you have a frame called TestFrame):
parent.TestFrame.location.href = "http://blah.com/" + sLanguage + "/help.htm";
// If you're not using frames:
// document.location.href = "http://blah.com/" + sLanguage + "/help.htm";
}
</script>
</head>
<body>
<form name="form1">
<select name="menu1" onChange="changelanguage(this)">
<option selected value="en">English</option>
<option value="we">Welsh</option>
</select>
</form>
</body>
</html>
* do not use the 'item name' as the attribute to get to your pages. Use the 'item value' instead as some language names can/will contain invalid characters for URLs. Also this is much more versitile; you don't need to update all your page urls if you change the language name a bit...
* do not use '.src', use '.location.href' for compatibily reasons
* with the use of 'this' in the form, you assign the current object's name. Much more versitile then adding it in your script directly (eg: you can have multiple menu's, and yet only 1 function)
PS: this is nothing new, but the host killercarrot.co.uk has had always had serieus troubles in their DNS updates (or whatever). I know many people who can access that site, including me. And this isn't the first time this happened, the other sites hosted on killercarrot had problems in the past also.
This post was edited on 03-14-2005 at 07:32 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
03-14-2005 07:24 PM |
|
|
user27089
Disabled Account
Posts: 6321
Joined: Nov 2003
Status: Away
|
O.P. RE: Dropdown boxes
parent.TestFrame.location.href = "http://blah.com/" + sLanguage + "/help.htm";
// If you're not using frames:
// document.location.href = "http://blah.com/" + sLanguage + "/help.htm";
what do I change them to? just http://mpsupport.killercarrot.co.uk ?
|
|
03-14-2005 07:30 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: Dropdown boxes
quote: Originally posted by traxor
parent.TestFrame.location.href = "http://blah.com/" + sLanguage + "/help.htm";
// If you're not using frames:
// document.location.href = "http://blah.com/" + sLanguage + "/help.htm";
what do I change them to? just http://mpsupport.killercarrot.co.uk ?
like I said, I (just like many others) can't access your site... I really suggest to get another host. The problem I'm experiencing atm is nothing new and happens regulary with killercarrot.co.uk...
But if you're not using frames it would be:
document.location.href = "http://mpsupport.killercarrot.co.uk/" + sLanguage + "/index.html";
and depending on the values in the list (eg: "en", "we") you need to have your pages at:
http://mpsupport.killercarrot.co.uk/en/index.html
http://mpsupport.killercarrot.co.uk/we/index.html
note: '//' are comment lines in javascript
This post was edited on 03-14-2005 at 07:37 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
03-14-2005 07:34 PM |
|
|
Dempsey
Scripting Contest Winner
http://AdamDempsey.net
Posts: 2395 Reputation: 53
38 / /
Joined: Jul 2003
|
RE: Dropdown boxes
quote: Originally posted by CookieRevised
like I said, I (just like many others) can't access your site... I really suggest to get another host. The problem I'm experiencing atm is nothing new and happens regulary with killercarrot.co.uk...
how long have u been having problems accessing killercarrot? is it just the last month or so?
This post was edited on 03-14-2005 at 07:53 PM by Dempsey.
|
|
03-14-2005 07:50 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|