Jump to content

Help With A Form Object


dzhax

Recommended Posts

Hey guys,I am trying to incorporate Quick Navigation into my website. It saves space on the page and personally I think it looks better. Any way now to my question.I have a simple drop down box with all of the links in it and I need it to navigate to the needed page when the value of the box is changed.I have the box in and all the links show up in there but I can not figure out how to navigate.This is what I have so far.

<td class="style4" style="width: 134px"><span class="style2">Quick Navigation:<br /><select name="menu0"><option value="http://hosting.dzhax.com">Home</option><option value="http://www.dzhax.com/order-hosting.php" selected>Server Hosting</option><option value="http://www.dzhax.com/order-domain.php">Domain Hosting</option><option value="http://www.dzhax.com/order-dedicated.php">Dedicated Hosting</option></select></span></td>

I was trying to use the onChange variable but I could not figure out what to put in the "" part of

<select name="menu0" onChange="">

Any help in this area would be greatly appricated!Thanks, Dzhax

Link to comment
Share on other sites

Hi, the answer for this depends if you are going to use javascript o your going to use a html form (with some php or .net).for a javascript i would do something like:<select name="menu0" id="menu0" onChange="openurl()" >in a js file o tag:function openurl(){ var selurl = document.getElementById('menu0').options[document.getElementById('menu0').selectedIndex].value; window.location.assign(selurl);}----------------------or with a server side language (php, .net) you would have to include the whole form:<form action="openurl.php" method="post" > <select name="menu0" > ... </select></form>and inside the openurl.php:<?php...$url = $_POST['menu0'];//maybe something likeheader("Location: " . $url);....?>their both examples, the js might work just like it is, the php needs more work, i would try to study both.

Link to comment
Share on other sites

man why cant web designing be like programming (everything on one line) lol.ok ill look into both.just to clarify. on the php script will it get the value of the option (which is set to the web address) or just the words displayed?---------------------------------------------------------------------------------- location=this.options[this.selectedIndex].value??? how could i even use that? its just random words to me an example might make it more clear. I know some basic html but when it comes to scripting and advanced web design im retarded.

Link to comment
Share on other sites

Hi,I have tested Deirdre's Dad suggestion, all you have to do is paste it inside the onchange like this - onchange="location=this.options[this.selectedIndex].value". Seems working fine =)

Link to comment
Share on other sites

man why cant web designing be like programming (everything on one line) lol.
Why not?
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}#gbar{height:22px;padding-left:2px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbi,#gbs{background:#fff;left:0;position:absolute;top:24px;visibility:hidden;z-index:1000}#gbi{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb3{height:22px;margin-right:.73em;vertical-align:top}#gbar{float:left}}.gb2{display:block;padding:.2em .5em}a.gb1,a.gb2,a.gb3{color:#00c !important}.gb2,.gb3{text-decoration:none}a.gb2:hover{background:#36c;color:#fff !important}</style><script>window.google={kEI:"XrMzSbvHNJHQsQKtoKGqAg",kEXPI:"17259,17311",kHL:"en"};google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};function sf(){document.f.q.focus()}window.clk=function(b,c,d,e,f,g){if(document.images){var a=encodeURIComponent||escape;(new Image).src="/url?sa=T"+(c?"&oi="+a©:"")+(d?"&cad="+a(d):"")+"&ct="+a(e)+"&cd="+a(f)+(b?"&url="+a(b.replace(/#.*/,"")).replace(/\+/g,"%2B"):"")+"&ei=XrMzSbvHNJHQsQKtoKGqAg"+g}return true};window.gbar={};(function(){var b=window.gbar,f,h;b.qs=function(a){var c=window.encodeURIComponent&&(document.forms[0].q||"").value;if©a.href=a.href.replace(/([?&])q=[^&]*|$/,function(i,g){return(g||"&")+"q="+encodeURIComponent©})};function j(a,c){a.visibility=h?"hidden":"visible";a.left=c+"px"}b.tg=function(a){a=a||window.event;var c=0,i,g=window.navExtra,d=document.getElementById("gbi"),e=a.target||a.srcElement;a.cancelBubble=true;if(!f){f=document.createElement(Array.every||window.createPopup?"iframe":"div");f.frameBorder="0";f.src="#";d.parentNode.appendChild(f).id="gbs";if(g)for(i in g)d.insertBefore(g[i],d.firstChild).className="gb2";document.onclick=b.close}if(e.className!="gb3")e=e.parentNode;do c+=e.offsetLeft;while(e=e.offsetParent);j(d.style,c);f.style.width=d.offsetWidth+"px";f.style.height=d.offsetHeight+"px";j(f.style,c);h=!h};b.close=function(a){h&&b.tg(a)}})();</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="sf();if(document.images)new Image().src='/images/nav_logo3.png'" topmargin=3 marginheight=3><div id=gbar><nobr><b class=gb1>Web</b> <a href="http://images.google.com.my/imghp?hl=en&tab=wi" onclick=gbar.qs(this) class=gb1>Images</a> <a href="http://news.google.com.my/nwshp?hl=en&tab=wn" onclick=gbar.qs(this) class=gb1>News</a> <a href="http://groups.google.com.my/grphp?hl=en&tab=wg" onclick=gbar.qs(this) class=gb1>Groups</a> <a href="http://books.google.com.my/bkshp?hl=en&tab=wp" onclick=gbar.qs(this) class=gb1>Books</a> <a href="http://mail.google.com/mail/?hl=en&tab=wm" class=gb1>Gmail</a> <a href="http://www.google.com.my/intl/en/options/" onclick="this.blur();gbar.tg(event);return !1" class=gb3><u>more</u> <small>▼</small></a><div id=gbi> <a href="http://scholar.google.com.my/schhp?hl=en&tab=ws" onclick=gbar.qs(this) class=gb2>Scholar</a> <a href="http://blogsearch.google.com.my/?hl=en&tab=wb" onclick=gbar.qs(this) class=gb2>Blogs</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.google.com/calendar/render?hl=en&tab=wc" class=gb2>Calendar</a> <a href="http://docs.google.com/?hl=en&tab=wo" class=gb2>Documents</a> <a href="http://www.google.com.my/reader/view/?hl=en&tab=wy" class=gb2>Reader</a> <a href="http://sites.google.com/?hl=en&tab=w3" class=gb2>Sites</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.google.com.my/intl/en/options/" class=gb2>even more »</a></div> </nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div align=right id=guser style="font-size:84%;padding:0 0 4px" width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com.my/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNHO3HnUsn1ir-YTXQz74XNTptRnqg">iGoogle</a></nobr></div><center><br clear=all id=lgpd><div align=left style="background:url(/intl/en_com/images/logo_plain.png) no-repeat;height:110px;width:276px" title="Google"><div nowrap style="color:#666;font-size:16px;font-weight:bold;left:208px;position:relative;top:78px">Malaysia</div></div><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%> </td><td align=center nowrap><input name=hl type=hidden value=en><input maxlength=2048 name=q size=55 title="Google Search" value=""><br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25%><font size=-2>  <a href=/advanced_search?hl=en>Advanced Search</a><br>  <a href=/preferences?hl=en>Preferences</a><br>  <a href=/language_tools?hl=en>Language Tools</a></font></td></tr><tr><td align=center colspan=3><font size=-1><span style="text-align:left">Search: <input id=all type=radio name=meta value="" checked><label for=all> the web </label><input id=cty type=radio name=meta value="cr=countryMY"><label for=cty> pages from Malaysia </label></span></font></td></tr></table></form><br><img src="http://www.google.com/images/sm_aids_ribbon.gif" width=20 height=30 align=middle alt=""><font size=-1>Learn more about <a href="/aclk?sa=L&ai=BH2S3XrMzScjUH4SIsgLCoaFt1cryd-utiocKwdmc2RPQhgMQARgBIMFUOABQvKLV5_n_____AWCRAQ&num=1&sig=AGiWqtzit3F5gdrcuUShMG9OmEO1Qu29Zw&q=http://www.google.com/search%3Fhl%3Den%26q%3DWorld%2BAIDS%2BDay">World AIDS Day</a>.</font><br><br><font size=-1>Google.com.my offered in: <a href="http://www.google.com.my/setprefs?sig=0_RvY1WdSCzyrrVaAFNu2UfHDB6xE=&hl=ms">Bahasa Malaysia</a> </font><br><br><br><font size=-1><a href="/intl/en/ads/">Advertising Programs</a> - <a href="/intl/en/about.html">About Google</a> - <a href=http://www.google.com/ncr>Go to Google.com</a></font><p><font size=-2>©2008 - <a href="/intl/en/privacy.html">Privacy</a></font></p></center></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...