/    Sign up×
Community /Pin to ProfileBookmark

Is there any way of displaying my own menu when a user clicks on select box on a form? If so is there a way of seeing what item was clicked.

Thanks

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@uruba_ukauthorFeb 01.2005 — Forgot to say that this has to be on a right click only.
Copy linkTweet thisAlerts:
@CharlesFeb 01.2005 — [font=monospace]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="Content-Script-Type" content="text/javascript">

<meta name="Content-Style-Type" content="text/css">

<title>Example</title>

<style type="text/css">

<!--

.hide {display:none}

-->

</style>

</head>

<body>

<script type="text/javascript">

<!--

if (document.getElementById) {

document.write('<select id="select"><option value="one">One</option><option value="two">Two</option></select>');

divs = new Array();
i = 0;
while (e = document.getElementById('select').getElementsByTagName ('OPTION')[i++]) {divs.push (e.value)}

function clear () {
var e, i = 0;
while (e = document.getElementById (divs[i++])) {e.className = 'hide'}
}

document.getElementById ('select').onchange = function () {
clear();
document.getElementById (this.value).className = '';
}

onload = clear

}

// -->

</script>

<div id="one">

<h4>One</h4>

<ul><li>Fee One</li> <li>Fie One</li> <li>Foe One</li> <li>Fum One</li></ul>

</div>

<div id="two">

<h4>Two</h4>

<ul><li>Fee Two</li> <li>Fie Two</li> <li>Foe Two</li> <li>Fum Two</li></ul>

</div>

</body>

</html>[/font]
Copy linkTweet thisAlerts:
@CharlesFeb 01.2005 — [i]Originally posted by uruba_uk [/i]

[B]Forgot to say that this has to be on a right click only. [/B][/QUOTE]
Then you'll have to be a lot more clear. I have no idea of what you are up to.
Copy linkTweet thisAlerts:
@uruba_ukauthorFeb 01.2005 — Thankyou for your response.

Does not really answer my question. I need to display a menu based on right click on a select box. The menu will be different depending on what item was right clicked.
Copy linkTweet thisAlerts:
@CharlesFeb 01.2005 — [i]Originally posted by uruba_uk [/i]

[B]Thankyou for your response.



Does not really answer my question. I need to display a menu based on right click on a select box. The menu will be different depending on what item was right clicked. [/B]
[/QUOTE]
But one doesn't right click on a select box. Please be more specific. Perhaps an example of your mark up whould be helpful.
Copy linkTweet thisAlerts:
@uruba_ukauthorFeb 01.2005 — Basically I have a matrix on the page built up of select boxes. Each select box contains a list of employees. What my client wants is the ability to right click on an employee in a select box and a menu appears listing all of the other select boxes (or a description of). Selecting one of these menu items will move the employee from one select box to another. I have done this already using drag and drop but the client wants a right click menu.

I hope this is clearer.

Thanks
Copy linkTweet thisAlerts:
@CharlesFeb 01.2005 — You lose me with the right click thing. Perhaps we mean different things by "select" box. Please demonstrate what you mean. See the above for what I mean.
Copy linkTweet thisAlerts:
@uruba_ukauthorFeb 01.2005 — sorry, when I say select box I mean with the height changed so it looks like a windows list box.
Copy linkTweet thisAlerts:
@CharlesFeb 01.2005 — [i]Originally posted by uruba_uk [/i]

[B]sorry, when I say select box I mean with the height changed so it looks like a windows list box. [/B][/QUOTE]
That doesn't help.
Copy linkTweet thisAlerts:
@uruba_ukauthorFeb 01.2005 — below is a very basic idea of what the page looks like. What I want is the user to be able to click on an employee in any of the select box using the right mouse button and for my own custom menu to appear.


<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="33%" id="table1">

<tr>

<td></td>

<td>1</td>

<td>2</td>

<td>3</td>

</tr>

<tr>

<td>a</td>

<td width="99"><select size="5" name="D1">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

<td width="99"><select size="5" name="D4">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

<td><select size="5" name="D9">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

</tr>

<tr>

<td>b</td>

<td width="99"><select size="5" name="D2">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

<td width="99"><select size="5" name="D5">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

<td><select size="5" name="D8">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

</tr>

<tr>

<td>c</td>

<td width="99"><select size="5" name="D3">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

<td width="99"><select size="5" name="D6">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

<td><select size="5" name="D7">

<option>Employee 1</option>

<option>Employee 2</option>

</select></td>

</tr>

</table>
×

Success!

Help @uruba_uk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...