Shoutbox

Dropdown boxes - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Dropdown boxes (/showthread.php?tid=40115)

Dropdown boxes by user27089 on 03-14-2005 at 06:08 PM

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>


RE: Dropdown boxes by L. Coyote on 03-14-2005 at 06:24 PM

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.
RE: Dropdown boxes by Stigmata on 03-14-2005 at 06:28 PM

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
RE: Dropdown boxes by user27089 on 03-14-2005 at 06:30 PM

quote:
Originally posted by Stigmata
would it be that hard to ask me once in a while

:lol: :lol:

Sorry, I'm used to just posting on here :p.

Thanks for your help anyway (y). But, its not in a folder called languages, so that would make it void :p... they're in seperate folders for each language...
RE: Dropdown boxes by Stigmata on 03-14-2005 at 06:33 PM

well rename the language to numbers for simplicity :)



RE: Dropdown boxes by user27089 on 03-14-2005 at 07:18 PM

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?


RE: Dropdown boxes by CookieRevised on 03-14-2005 at 07:24 PM

<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.


RE: Dropdown boxes by user27089 on 03-14-2005 at 07:30 PM

      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 ?


RE: Dropdown boxes by CookieRevised on 03-14-2005 at 07:34 PM

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
RE: Dropdown boxes by Dempsey on 03-14-2005 at 07:50 PM

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?
RE: Dropdown boxes by CookieRevised on 03-14-2005 at 08:26 PM

Since I knew it existed (thus as in years(?))...
And I'm not the only one. In fact, IIRC some pages on killercarrot have been moved to other hosts because of it in the past <= but that can be a faulty memory of mine though.


RE: Dropdown boxes by saralk on 03-14-2005 at 08:30 PM

if you want a simpler way of making a drop down menu

http://www.echoecho.com/tooldropdown.htm


RE: Dropdown boxes by Dempsey on 03-14-2005 at 08:31 PM

oh i thought it might have just been the past month or so since I've had a new host.  I've had about 4 different hosts and now I'm hosting myself and hopefully more people will be able to access the site now