-
AuthorPosts
-
bmtoth Friend
bmtoth
- Join date:
- May 2008
- Posts:
- 101
- Downloads:
- 0
- Uploads:
- 0
- Thanks:
- 29
- Thanked:
- 6 times in 1 posts
October 9, 2010 at 7:01 pm #155122How do we go about linking the items in the drop down box at the top of the page?
Thanks for any pointers.
Phill ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
October 9, 2010 at 9:36 pm #358316Which item? The ones in the main menu or the top right marked USA, UK etc?
The dropdown is a simple html options list (google the <option> tag for more information). It is located in the module position “Top”. You can put whatever you want in that module position.
amir00251 Friendamir00251
- Join date:
- January 2011
- Posts:
- 113
- Downloads:
- 38
- Uploads:
- 13
- Thanks:
- 13
- Thanked:
- 11 times in 1 posts
February 21, 2011 at 6:55 pm #377801I have tried various different codes to sort out this linking with no success. For example
<option value=”http://www.southafrica.com”>South Africa</option>
Can you please give a example, instead of referring to search engines. I have tried some more codes and the results are the same. Can someone use this custom code for other JA templates? Thanks.
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
February 22, 2011 at 9:30 am #377915you meant you want South Afica to appear as a link that can be clicked? I think its not possible, cause <option> tag can not contain a link.
amir00251 Friendamir00251
- Join date:
- January 2011
- Posts:
- 113
- Downloads:
- 38
- Uploads:
- 13
- Thanks:
- 13
- Thanked:
- 11 times in 1 posts
February 22, 2011 at 4:33 pm #377963Thanks for your reply. The South Africal is just an example with an example url. What I want is that by choosing South Africa as an example by user, the browser could be redirected to a website related to that choice. Say like multilingual websites, you have the dropdown for languages and choosing each language redirects to the right url.
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
February 23, 2011 at 10:25 am #378091you have to modify the code, mainly javascript, for a direction you should do as following:
have a dropdown list that use <select> tag which has the onchange event bound to a javascript function, in that function you have the javascript code to redirect browser to selected url.
There are much docs on web that you can consult in order to acomplish this.amir00251 Friendamir00251
- Join date:
- January 2011
- Posts:
- 113
- Downloads:
- 38
- Uploads:
- 13
- Thanks:
- 13
- Thanked:
- 11 times in 1 posts
February 23, 2011 at 1:20 pm #378113Hello, it would have been good when this template was designed to put a sample javascript code for this module which does have the links in. I now add the Javascript code and after saving when I go back to the html, the code has been disappeared. Should this code be inserted in the html area?
The original code in module is:
<ul class=”quick-contact”>
<li class=”phone”><strong>Sales: </strong>0987 989898</li>
<li class=”email”><strong>Email: </strong><a href=”#” title=”Sample link”>info@yourdomain.com</a></li>
<li class=”sites”><strong>Sites: </strong><select id=”inputbox”><option>USA</option><option>UK</option><option>France</option><option>Japan</option><option>South Africa</option></select></li>
</ul>and I have changed this to
<ul class=”quick-contact”>
<li class=”phone”><strong>Sales: </strong>0987 989898</li>
<li class=”email”><strong>Email: </strong><a href=”#” title=”Sample link”>info@yourdomain.com</a></li>
<li class=”sites”><strong>Sites: </strong><select id=”inputbox”>
<option value=”nothing” selected=”selected”>Select a site</option>
<option value=”http://www.testdomain.com/us”>USA</option>
<option value=”http://www.testdomain.com/uk”>UK</option>
<option value=”http://www.testdomain.com/fr”>France</option>
<option value=”http://www.testdomain.com/ja”>Japan</option>
<option value=”http://www.testdomain.com/sf”>South Africa</option>
</select><script type=”text/javascript”>
var selectmenu=document.getElementById(“inputbox”)
selectmenu.onchange=function(){ //run some code when “onchange” event fires
var chosenoption=this.options //this refers to “selectmenu”
if (chosenoption.value!=”nothing”){
window.open(chosenoption.value, “”, “”) //open target site (based on option’s value attr) in new window
}
}</script>
</li>
</ul>found this code in http://www.javascriptkit.com/jsref/select.shtml which is working fine in the demo on that website but it does not seem to work in my joomlart template. Anything I should change or do? Thanks.
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
February 24, 2011 at 8:43 am #378249it seems to be cleaned by MCE editor when you saved.
try go to global configuration and choose text editor to None, you will be able to save the js code.amir00251 Friendamir00251
- Join date:
- January 2011
- Posts:
- 113
- Downloads:
- 38
- Uploads:
- 13
- Thanks:
- 13
- Thanked:
- 11 times in 1 posts
February 24, 2011 at 10:12 am #378262Hello, Thanks for the advive. I did that and what happens is that javascript code shows up on the website after dropdown like a text. I am not really sure that this is the reason, there should probably be another reason. That is why I think it would have been good to make a example on the template for linking different dropdown options to a test url.
Sherlock FriendSherlock
- Join date:
- September 2014
- Posts:
- 11453
- Downloads:
- 0
- Uploads:
- 88
- Thanks:
- 221
- Thanked:
- 2478 times in 2162 posts
February 25, 2011 at 2:47 am #378337Dear amir00251,
I tried with the codes you posted and I saw it working well :),Please check it again
amir00251 Friendamir00251
- Join date:
- January 2011
- Posts:
- 113
- Downloads:
- 38
- Uploads:
- 13
- Thanks:
- 13
- Thanked:
- 11 times in 1 posts
February 28, 2011 at 3:15 pm #378884Hello,
I have tested again, I even copy pasted exact same code from original website, still the same results. After saving, the Javescript code disappears and no redirection on the frontend! I will try to use a ticket system for support team could have a look at the code in my backend. Thanks
March 14, 2011 at 2:01 am #381149For me it doesn’t work 🙁 HELP, please http://www.renouveau.be/NEW/
March 18, 2011 at 4:34 pm #382106And to go in the same window ? (interne link)
:(( Help please 🙂Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
March 21, 2011 at 10:15 am #382494<em>@andrzejmarek 227415 wrote:</em><blockquote>For me it doesn’t work 🙁 HELP, please http://www.renouveau.be/NEW/</blockquote>
Can you give me your admin access to your site via PM. I will try to check and fix it for you.April 2, 2011 at 12:48 am #384493You have to remove the double quotes in web pages, then everything works. These were inserted at least for me, by copy / paste the html code.
<option value=”“http://www.testdomain.com/us“”>USA</option>
Hope it helps.
BTW: Thanx a lot for the code!!!!!!!!!! I’ve tried for weeks about it but never managed to get that it looks like in the demo. Now it fits!
-
AuthorPosts
This topic contains 17 replies, has 9 voices, and was last updated by pritam 13 years, 5 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum