PDA

View Full Version : How to make first item in the menu clickable



nizamo
05-29-2013, 02:29 PM
I want to first item in the menu clickable (go to the page I specified) how to do this?


http://6g6.eu/sih0-111snap000708.jpg

Head section:

<script language="javascript" type="text/javascript">
<!--
function menu_goto( menuform )
{
var baseurl = "http://www.aymavisi.org/" ;
selecteditem = menuform.newurl.selectedIndex ;
newurl = menuform.newurl.options[ selecteditem ].value ;
if (newurl.length != 0) {
location.href = baseurl + newurl ;
}
}
//-->
</script>


Body part:


<select name="newurl" onchange="menu_goto(this.form)" style=" color: #FFFFFF; text-decoration: none; font-family: Tahoma; font-weight: bold; text-align: center; background-color: #444577;padding: 2px; font-size:9pt; width:130" size="1" id="menu">
<option value=""></option>
<option value="index.html">Ana Sayfa</option>
<option value="8 Felsefe.htm">Felsefe</option>
<option value="9 Siir.htm">Şiir</option>
<option value="2 Makale.htm">Makale</option>
<option value="4 Hikaye.htm">Hikaye</option>
<option value="3 Psikoloji.htm">Psikoloji</option>
<option value="5 Guncel.htm">Güncel</option>
<option value="6 Kitap.htm">Kitap</option>
<option value="7 Muzik.htm">Müzik</option>
<option value="999 Benden.htm">Benden</option>
<option value="99 Egzersiz.htm">Egzersiz</option>
<option value="hata raporu.html">Hataları bildirin</option>
<option value="1 yeniler.html">Yeni eklenenler</option>
<option value="../ziyareci defteri/index.php?&amp;mots_search=&amp;lang=english&amp;skin">
Ziyaretçi defteri</option>
</select>

jscheuer1
05-29-2013, 08:54 PM
As long as it's not the default selected, it should be clickable.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

nizamo
05-29-2013, 09:17 PM
Sorry, I forget to add it, here:

http://www.aymavisi.org/makale/Aska%20Dair%20-%20Halil%20Cibran.html

jscheuer1
05-30-2013, 02:36 AM
That's a different select than from your post, and that page is not on the list.

The select in your post has an empty option at the beginning which would make all of the others clickable.

Even without that, if this page were on the list, you could hard code its option as selected, which would make all of the other pages on the list clickable. Like if this page were the "9 Siir.htm" page, you could select its option like so:


<select name="newurl" onchange="menu_goto(this.form)" style=" color: #FFFFFF; text-decoration: none; font-family: Tahoma; font-weight: bold; text-align: center; background-color: #444577;padding: 2px; font-size:9pt; width:130" size="1" id="menu">
<option value="index.html">Ana Sayfa</option>
<option value="8 Felsefe.htm">Felsefe</option>
<option value="9 Siir.htm" selected>Şiir</option>
<option value="2 Makale.htm">Makale</option>
<option value="4 Hikaye.htm">Hikaye</option>
<option value="3 Psikoloji.htm">Psikoloji</option>
<option value="5 Guncel.htm">Güncel</option>
<option value="6 Kitap.htm">Kitap</option>
<option value="7 Muzik.htm">Müzik</option>
<option value="999 Benden.htm">Benden</option>
<option value="99 Egzersiz.htm">Egzersiz</option>
<option value="hata raporu.html">Hataları bildirin</option>
<option value="1 yeniler.html">Yeni eklenenler</option>
<option value="../ziyareci defteri/index.php?&mots_search=&lang=english&skin">Ziyaretçi defteri</option>
</select>

It would be highlighted and selected by default, all other pages would be clickable.

Or, You could just put this script as the last thing before the closing </body> tag:


<script type="text/javascript">
document.getElementsByName('newurl')[0].options.selectedIndex = -1;
</script>

nizamo
05-30-2013, 12:36 PM
Second method just fine for me, thank you Mr. John, once again you helped me lot!