i created a dropdown list containing university names e.g. 'oxford' 'cambridge' and so on. I would like the uni selected from the dropdown list to be sent to another page as the heading.
I am having trouble doing this myself and I dont want to create a page for every single uni. can anyone help?

Recommended Answers

First of all this is a question for the JSP forum.
Secondly what do you mean when you say "heading". Explain better with some code.
Also you can submit the page and when you go at the the next page you can do this:

<%
String uni …
Jump to Post

Please forgive but I don't understand what you mean by new layer. Can you post code or a picture indicating where you want the "uni" to be displayed?

Jump to Post

You should AJAX for this sort of thing dynamic interaction and JSP just as container to hold/present content...

Jump to Post

All 10 Replies

First of all this is a question for the JSP forum.
Secondly what do you mean when you say "heading". Explain better with some code.
Also you can submit the page and when you go at the the next page you can do this:

<%
String uni = request.getParameter("uni");
%>
<head>
<title><%= uni%><title>
</head>

by heading, i mean a new layer on the 2nd page, i would like the selected text sent from the drop down list on page1.htm to a new layer on page2.htm

Please forgive but I don't understand what you mean by new layer. Can you post code or a picture indicating where you want the "uni" to be displayed?

there is another quick help i need aswell me getting the code for what i just said. here is a code i hae for moving an item from one list box to another, but the item will not move... the you know what is wrong ith what i wrote.

<table border="0">
	<tr>
		<td>
			<select name="sel1" size="10" multiple="multiple">
			<option value="1">Left1</option>
			<option value="2">Left2</option>
			<option value="3">Left3</option>
			<option value="4">Left4</option>
			<option value="5">Left5</option>
			</select>
		</td>
		<td align="center" valign="middle">
			<input type="button" value="--&gt;"
			 onclick="moveOptions(this.form.sel1, this.form.sel2);" /><br />
			<input type="button" value="&lt;--"
			 onclick="moveOptions(this.form.sel2, this.form.sel1);" />
		</td>
		<td>
			<select name="sel2" size="10" multiple="multiple">
			<option value="1">Right1</option>
			<option value="2">Right2</option>
			<option value="3">Right3</option>
			<option value="4">Right4</option>
			<option value="5">Right5</option>
			</select>
		</td>
	</tr>
</table>
</form>

You should AJAX for this sort of thing dynamic interaction and JSP just as container to hold/present content...

If it doesn't work then there is a problem with the "moveOptions" method for which you didn't provide code

i am a beginner in writing sripts so i would need help in how i would and where i would write this 'move' please

I never had to do something like this before, so frankly I am not in the mood to write code that does that.
But If I were to do this I would look at this site:
http://www.w3schools.com/default.asp
for tutorials on the subjects:
HTML DOM and
DHTML

You can use the id attribute to get the "select" and "option" tags as javascript variables and by using the above tutorials and API you can manipulate them

here is the code i am using,

<html>
<head>
<script type="text/javascript">
function University()
{
var mylist=document.getElementById("myList");
document.getElementById("favorite").value=mylist.options[mylist.selectedIndex].text;
}
</script>
</head>

<body>
<form>
Select your University:
<select id="myList" onchange="University()">
  <option>Brunel</option>
  <option>Kingston</option>
  <option>Kent</option>
</select>
<div id="Layer1" style="position:absolute; left:368px; top:175px; width:257px; height:100px; z-index:1">Your University: <input type="text" id="favorite" size="20"></div>
</form>
</body>

i want the 'select your uni' to be on page1.htm and the second part 'your university' = the result to be on page2.htm, how o i go about this please.

<select name="selectedUniversity" >
  <option>Brunel</option>
  <option>Kingston</option>
  <option>Kent</option>
</select>

Submit the form to the next page and at the next page have this code:

<%
String university = request.getParameter("selectedUniversity");
if (university==null) university = "";
%>


<div id="Layer1" style="position:absolute; left:368px; top:175px; width:257px; height:100px; z-index:1">
Your University: 
<input type="text" name="favorite" value="<%= university%>" size="20">
</div>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.