A little text manipulation (ASCII values)

Posted on 2003-03-25
Medium Priority
Last Modified: 2013-12-24
Hope the title is not misleading -

I have a drop-down box that I use to select a year.
I would like to have other buttons or icons on the page that call up different pages based on the year selected.

In other words, say there are buttons called "NEWS", "PHOTOGRAPH", and "INFO" next to the drop-down box for the year.

The user first selects a year (which I already have calling up another page when SUBMIT is pressed).
Then if the user wants to see news on that year, he/she clicks the NEWS button. Or the PHOTOGRAPH button or INFO.

So behind the scenes, the drop-down form has a variable named 'Year'.
How can I take the value of 'Year' and combine it with other text in the other buttons?

For example: Pressing NEWS would take the value of 'Year' + a filename literal entered in the button form such that pressing it would call up a page using the combined text.

So I am basically building a new text string from different points.
In a formula (from other languages) it might look like this:
Webpage = "news-" + Year + ".htm"

So if the year selected is 2003, the result of Webpage = "news-2003.htm"
I could then retrieve that particular page.

It is probably simple HTML code so excuse the ignorance - thanks in advance!
Question by:mpulse24
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 8208844
something like this?

<script type="text/javascript">
   function showYearFile()
    selectedYear = document.getElementById('definer').options[document.getElementById('definer').selectedIndex].value;
    alert("news-" + selectedYear + ".htm");
    document.getElementById('firstLink').href = "news-" + selectedYear + ".htm";
<form name="myform"><select id="definer" onchange="showYearFile()">
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<a href="" id="firstLInk">go</a>

tell me if I am on the right track
LVL 14

Accepted Solution

hhammash earned 300 total points
ID: 8209772

In the Select tag you have OnChange.
The options should be there with you
Now add the code under the </Select> in your page
This code is for one link which is the year.

<form method="POST" action="GotoYear.asp" name="form1">
  <select size="1" name="Year" onChange=form1.submit()>
  <option value="2001">2001</option>
  <option value="2002">2002</option>
  <option value="2003">2003</option>
  <option value="2004">2004</option>
  <option value="2005">2005</option>
  <option value="2006">2006</option>
Dim VarLoc
<a href=<%=varDest%>>Go to Page</a>


Author Comment

ID: 8215954
That did it.
I also like the Onchange feature. I was getting a little annoyed with that ugly "SUBMIT" button.
Thanks for the quick response!
LVL 14

Expert Comment

ID: 8216846
Hi mpulse24,

You are most welcome


Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question