|
Hi all,
I want to add the selected element from one listbox to another listbox and remove also on button click event >(button text for add) and <(button text for remove).
Also I need to add all the element from one listbox to another and remove also on button click event >>(button text for add all) and <<(button text for remove all).
I want to do this with Javascript.
Please help me as I have to do this by today.
Thanks in advance.
|
|
|
|
|
Hi try this out it may help u
var conAdd = 'Add';
var conRemove = 'Remove';
var delimiter = "|";
function MoveOption(f, From, To, action)
{
var eFrom = eval('f.msb' + From);
var eTo = eval('f.msb' + To);
var selection = eFrom.options.selectedIndex;
var eAddContainer;
var eRemoveContainer;
if (action == conAdd)
{
eAddContainer = eval('f.htx' + conAdd + To);
eRemoveContainer = eval('f.htx' + conRemove + To);
}
if (action == conRemove)
{
eAddContainer = eval('f.htx' + conRemove + From);
eRemoveContainer = eval('f.htx' + conAdd + From);
}
if (selection == -1)
{
alert("Please select one or more users to move.");
}
else
{
eval('f.cmd' + action + '.disabled = true;');
for (i = 0; i < eFrom.options.length; i++)
{
if(eFrom.options[i].selected)
{
var name = eFrom.options[i].text;
var ID = eFrom.options[i].value;
eFrom.options[i] = null;
eTo.options[eTo.options.length] = new Option (name,ID);
i = i - 1;
var rep = new String('\\' + delimiter + ID + '\\' + delimiter + '');
var repExp = new RegExp(rep);
}
}
}
}
function onChange_msbUserPool(f)
{
f.cmdAdd.disabled = (f.msbUserPool.selectedIndex == -1);
}
function onChange_msbAssignedUser(f)
{
f.cmdRemove.disabled = (f.msbAssignedUser.selectedIndex == -1);
}
function moveup(list)
{
var daflag = false
for (var i = 0; i <= list.options.length-1; i++) {
if (!list[i].selected) {
daflag = true
}
if (list[i].selected && daflag) {
list.insertBefore(list[i],list[i-1])
}
}
}
function test()
{
newtest();
}
function movedown(list)
{
var daflag = false
for (var i = list.options.length-1; i >= 0; i--) {
if (!list[i].selected) {
daflag = true
}
if (list[i].selected && daflag) {
list.insertBefore(list[i],list[i+2])
}
}
}
All Element | Selected Elements |
1
2
3
4
5
|
|
|
|
|
|
UP
Down
|
SP
--
Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
|
|
|
|
|
Thanks for the reply sir. I got some code but its not working I am not able to track whats wrong.
<html>
<head>
<script language="JavaScript">
function f_optionMove(s_from, s_to)
{
alert(s_from);
var e_from = document.forms['test_form'].elements[s_from],e_to = document.forms['test_form'].elements[s_to];
alert(e_from);
if (!e_from)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
var n_moved = 0;
for (var i = 0; i < e_from.options.length; i++)
{
if (e_from.options.selected)
{
e_to.options[e_to.options.length] = new Option(e_from.options.text, e_from.options.value);
n_moved++;
}
else if (n_moved)
e_from.options[i - n_moved] = new Option(e_from.options.text, e_from.options.value);
}
if (n_moved)
e_from.options.length = e_from.options.length - n_moved;
else
alert("You haven't selected any options");
}
function f_optionMoveAll(s_from, s_to)
{
var e_from = document.forms['test_form'].elements[s_from],e_to = document.forms['test_form'].elements[s_to];
if (!e_from)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
e_to.options.length = 0;
for (var i = 0; i < e_from.options.length; i++)
e_to.options = new Option(e_from.options.text, e_from.options.value);
e_from.options.length = 0;
}
function f_selectAll (s_select)
{
var e_select = document.forms['test_form'].elements[s_select];
for (var i = 0; i < e_select.options.length; i++)
e_select.options.selected = true;
}
</script>
</head>
<body>
<form id="test_form" name="test_form" runat="server">
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td>
<select multiple name="source" style="width: 170px; height: 170px">
<option>Vishal</option>
<option>Pooja</option>
<option>Dnyandeo</option>
<option>Varsha</option>
<option>Aditi</option>
<option>Nilesh</option>
</select>
</td>
<td>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td>
<input type="Button" style="width: 200px;" value="Add Selected >>" onclick="f_optionMove('source', 'destination')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Remove Selected <<" onclick="f_optionMove('destination', 'source')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Add All >>" onclick="f_optionMoveAll('source', 'destination')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Remove All <<" onclick="f_optionMoveAll('destination', 'source')">
</td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Select All Sources" onclick="f_selectAll('source')"></td>
</tr>
<tr>
<td>
<input type="Button" style="width: 200px;" value="Select All Destinations;" onclick="f_selectAll('destination')"></td>
</tr>
</table>
</td>
<td>
<select multiple name="destination" style="width: 170px; height: 170px">
</select>
</td>
</tr>
</table>
</form>
</body>
</html>
Please tell me where I am going wrong.
|
|
|
|
|
hi all,
has anybody an idea how can i customize the design of my media player?
and is there also an reference how can i controll the mediaplayer from javascript ?
greetings gigo
|
|
|
|
|
media player is not the most flexible utility to use when displaying interactive content. You would be better off using a flash client.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
|
Hello all,
I have designed a dropdown menu with simple javascript code but actually when disabling the "javascript" property from IE, the menu doesn't work. instead i found this site: "http://www.redballoondays.com.au/" which has same dropdown and it works even if i disabled the javascript property from IE.
So can anyone help me in running me menu even if the javascript is disabled in IE.
Thank you
|
|
|
|
|
That website is using CSS rather than javascript for the menu (a much better way). Theres plenty of examples out there on how to do this (I think the dynamic drive site has a few)
|
|
|
|
|
what about this?? this is the script used by the website
but if you have examples for using css in dropdown menus, please mention one
Thank you
<![CDATA[//><!]]>
|
|
|
|
|
My bad, it does use CSS but it only works in Firefox, that script is for IE. I tried the site in IE with javascript turned off though and it didn't work. It is possible to use a pure CSS solution for both IE and Firefox, like I said search for it on google there are examples out there (bear in mind that a lot of them won't work in both!).
Heres one source for starters:
http://www.dynamicdrive.com/style/
|
|
|
|
|
Hi
I m developing a web portal in c# asp.net web application .i want to built an email client.My email client will include the functionalty as
Making new account
sending e mail with attachments
receiving email with inbox maintaing facility. etc
but i have not any idea about it. Can any one guide us first of all about the email server that which server should b used 2ndly how it can be used n from where v can get help regading its builtin methods to b used in email client.
v want help in C# not in HTML codin
Thanx
|
|
|
|
|
From what I remember the the .NEt framework has support for IIS's SMTP server.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
Hi Guys
I am supporting an ASP application, there is a form in this application which have more than 300 fields. Now sometime data fails at the time of submission. There are 6 screens and session variable are being used to save form data temporarily and move between the screens.
Is there any other way to handle such a huge form?
Please do reply ASAP
Thanks
Ajit Singh
|
|
|
|
|
A 300 field form is a usabillity nightmare. I'd break it up into multiple forms, perhaps as a wizard ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
True. It would for sure send chill waves down the spine for the user though.
|
|
|
|
|
I made a test a while back on how many fields you could have in a form, and it showed that somewhere around 100 fields the browser started acting up. IIRC that was IE 5.0 on Windows 98, so newer browsers in newer operating sytems probably have a higher limit. Still, the limit is not very high, so it's quite possible that you have more fields in the form than the browser can handle.
The way to handle such a huge form is not to. Split it up in smaller forms.
---
Year happy = new Year(2007);
|
|
|
|
|
Hello All
I need to send email using Binary SOAP. I used DIME but i realised that
it only send attachment by binary soap, though my requirement is that i
need to send attachment AND the enter email attributes(user's and receipient
email, message, subject line). can anyone tell me how can i have this done and
which technique to use for sending all these attributes using Binary SOAP.
BEST !!
Ankit Sharma
|
|
|
|
|
|
Thanks for the quick responce, Deepak but my problem is more of a backend thing.
I am trying to figure out what is causing the problem. Let me eleborate on the question
that might help you undestand the problem. According to my requirement here is what i am doing.
At the client end, i create a DIME attachment and then a webservice call to the server whete it is authenticated. There is a function which sends email. It has the following parameters:
Retrieve data (which is the sender and receipient's email addresses and message)
Retrieve attachment
Create email
Attach the attachment
Send email
"Attach the attachment" is where i am stuck. When i try to attach the attachment,it throws an exception that the obj ref is not set OR path incorrect. It just won't work !!
Any Clues !!
BEST !!
Ankit Sharma
|
|
|
|
|
alright, disregard..i have the answer. there is no way the WSE 2.0 and 3.0 can communicate.
I amstead found a library to send emails from SMTP which can send STREAM data.
Ankit
|
|
|
|
|
I have been developing a web application which relies heavily on DOM. Everything seems to be working except I cannot name my input tags. Here's my original code:
textbox = document.createElement("input");
textbox.type="text";
textbox.className="textbox";
textbox.name="MyTextboxName";
document.appendChild(textbox);
This code works fine, and everything is displayed. The only problem is that the name, MyTextboxName, is not being put into the code. when I do an innerHTML on the object that I am inserting the textbox in, I see everything EXCEPT for name="MyTextboxName". If I change textbox.name="MyTextboxName"; to textbox.Name="MyTextboxName"; (notice the capital "N"), I get Name="MyTextboxName" put into the code when I do an innerHTML. The only problem is, when I do a document.getElementsByName("MyTextboxName").length;, I get 0 returned, which means that it cannot be found. Also, if I target the element by index number, I get a textbox.name="" and textbox.Name=undefined.
|
|
|
|
|
i want to print the results of a dynamic webpage. i want to count the no. of pages and insert page header and footer in each page dynamically. how can i do that ? can i do that using javascript??
|
|
|
|
|
Can you further define what you are asking?
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
i am dynamically generating accounting reports and balance sheets. then i want to provide an option for print. the user can specify custom headers and footers for the pages of the report and they should be printed on each page of the report. how can i do that??
|
|
|
|
|
Ok reserch the following:
Ajax
window.print();
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|