473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Language Switch with Javascript

Hi all,

Kinda new and JS, anyone know how I can created a generic script that would change a pagename-e.html to pagename-f.html

The menu is in an SSI and I want to be able to change language on the fly for that specific page.

Anyone got any ideas or easy examples?

Thanks
Mar 24 '07 #1
1 5653
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1.  
  2. <script>
  3. function changelang(val) {
  4. var cur = window.location;
  5. cur = cur.split(".html");
  6. var newlocation = cur[0];
  7. newlocation = newlocation.substr(0, cur[0].length-1)+val+".html";
  8. window.location = newlocation;
  9. }
  10. </script>
  11. <select id="language" name="language" onchange="changelang(this.value)">
  12. <option value="">Select Language</option>
  13. <option value="e">English</option>
  14. <option value="f">French</option>
  15. </select>
  16.  
Heres a generic example I made up for you

This will only work if the current location has -e -f or -any letter

we don't normally give away scripts without an effort of the user but this one was pretty simple and i hope you look through the code and learn how it works it will help you in the future.. ask any questions about the code you don't understand.
Mar 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Robert Scheer | last post by:
Hi. I am trying to use switch this way, without success: //thedata is a numeric variable switch (thedata) { case < 10: ... case < 20: ...
134
by: evolnet.regular | last post by:
I've been utilising C for lots of small and a few medium-sized personal projects over the course of the past decade, and I've realised lately just how little progress it's made since then. I've...
2
by: Tumurbaatar S. | last post by:
Hi all! I'm going to develop web app-s in ASP.NET and wondering what language, C# or JScriptNET, to choose for this. I have some experience on writing ASP pages with JScript and Win32 app-s with...
4
by: walter | last post by:
The question sound simple -- I had a multilingual site, I give a button on each page to allow user switch to different language, and of cause I want to use asp.net 2 globalization mechanism. So...
7
by: cytec123187 | last post by:
Hello, I am working on an Adobe Acrobat file that uses javascript for calculations. I am trying to create a field that uses two other fields to determine a number value. I think this requires...
5
by: Martin | last post by:
Morning, I am developing a C# 2.0 application and I have created two language (English and French) for my main form. In Visual Studio 2005, I can switch language with the Language property...
11
by: Bob Rosen | last post by:
I have used VB.NET for several months. Just recently I was asked to modify some web pages that were developed with C#. Although I know that C# is much more popular, in comparing the two all of...
1
by: mouton | last post by:
Hello, I am a beginner. My website has 2 pages: one in English and one in French. I would like non English people to be directed to the English page. There I would like to display a...
2
by: Immortal Nephi | last post by:
I did a lot of research on the internet. There are many discussions. The discussion states that writing class with pointer to member function in C++ language is the wrong language. Some say to...
56
by: Adem | last post by:
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15) says under...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.