Click here to Skip to main content
15,915,032 members
Home / Discussions / Web Development
   

Web Development

 
QuestionSorting in paging environment Pin
swapnil.jaiswal25-Oct-06 3:25
swapnil.jaiswal25-Oct-06 3:25 
AnswerRe: Sorting in paging environment Pin
Guffa25-Oct-06 4:06
Guffa25-Oct-06 4:06 
AnswerRe: Sorting in paging environment Pin
ednrgc25-Oct-06 6:48
ednrgc25-Oct-06 6:48 
QuestionRich Text Editor Pin
Bradml25-Oct-06 1:36
Bradml25-Oct-06 1:36 
AnswerRe: Rich Text Editor Pin
ednrgc25-Oct-06 6:51
ednrgc25-Oct-06 6:51 
AnswerRe: Rich Text Editor Pin
Fred_Smith25-Oct-06 11:15
Fred_Smith25-Oct-06 11:15 
AnswerRe: Rich Text Editor Pin
DavidNohejl30-Oct-06 10:01
DavidNohejl30-Oct-06 10:01 
QuestionJavascript not working in Firefox.... Pin
Fred_Smith24-Oct-06 12:23
Fred_Smith24-Oct-06 12:23 
The code below is for a simple form with a listbox and two buttons that can be used to re-order the items using Javascript - the new order is then written to a hidden text input field (which is sent back to the server on postback and can be processed there.)

It works fine in Internet Explorer but not in Firefox. If anyone knows why, or has better code (I freely admit to not being an expert in javascript) I would be grateful
thanks
Fred



<HTML>
<HEAD>
<TITLE></TITLE>

<script language="javascript">
<!--
function moveup() {
var s = document.getElementById("s1");
// get select items details
var i = s.selectedIndex;
if (i<1) {return true;} // nothing to do
var n = s.options(i).value;
var t = s.options(i).text;
// get details of next item one up the list;
var i1 = i-1;
var n1 = s.options(i1).value;
var t1 = s.options(i1).text;
var l = s.length;
var a = new Array();
var b = new Array();
// var to hold new order
var o = '';
var x;
for (x=0;x<l;x++) {
a[x] = s.options(x).value;
b[x] = s.options(x).text;
}
s.options.length=0;
for (x=0;x<l;x++) {
if (x==i1) {
s.options[x] = new Option(t,n,true,true);
s.options[x+1] = new Option(t1,n1);
x++;
} else {
s.options[x] = new Option(b[x],a[x]);
}
}
for (x=0;x<l;x++) {
o += s.options(x).value+',';
}
var tx = document.getElementById("t1");
tx.value = o;
return true;
}

function movedown() {
var s = document.getElementById("s1");
var l = s.length;
// get select items details
var i = s.selectedIndex;
if (i==l-1 || i==-1) {return true;} // nothing to do
var n = s.options(i).value;
var t = s.options(i).text;
// get details of next item one down the list;
var i1 = i+1;
var n1 = s.options(i1).value;
var t1 = s.options(i1).text;
var a = new Array();
var b = new Array();
// var to hold new order
var o = '';
var x;
for (x=0;x<l;x++) {
a[x] = s.options(x).value;
b[x] = s.options(x).text;
}
s.options.length=0;
for (x=0;x<l;x++) {
if (x==i) {
s.options[x] = new Option(t1,n1);
s.options[x+1] = new Option(t,n,true,true);
x++;
} else {
s.options[x] = new Option(b[x],a[x]);
}
}
for (x=0;x<l;x++) {
o += s.options(x).value+',';
}
var tx = document.getElementById("t1");
tx.value = o;
return true;
}

// -->
</script>

</HEAD>
<BODY BGCOLOR="#FFFFFF">

<form>

<select name="s1" size="4">
<option value="Red">Red</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
<option value="Yellow">Yellow</option>
</select>

<input type="button" value="Up" onclick="moveup();">
&nbsp;
<input type="button" value="Down" onclick="movedown();">
<br><br><br>
<input type="hidden" name="t1">

</form>

</BODY>
</HTML>
AnswerRe: Javascript not working in Firefox.... Pin
Guffa24-Oct-06 12:44
Guffa24-Oct-06 12:44 
GeneralRe: Javascript not working in Firefox.... Pin
Fred_Smith24-Oct-06 13:31
Fred_Smith24-Oct-06 13:31 
GeneralRe: Javascript not working in Firefox.... Pin
Fred_Smith24-Oct-06 13:57
Fred_Smith24-Oct-06 13:57 
AnswerRe: Javascript not working in Firefox.... Pin
Guffa24-Oct-06 14:21
Guffa24-Oct-06 14:21 
GeneralRe: Javascript not working in Firefox.... Pin
Fred_Smith24-Oct-06 23:45
Fred_Smith24-Oct-06 23:45 
Questionjavascript help please...... Pin
tha.karthik24-Oct-06 4:11
tha.karthik24-Oct-06 4:11 
AnswerRe: javascript help please...... Pin
Guffa24-Oct-06 6:35
Guffa24-Oct-06 6:35 
AnswerRe: javascript help please...... Pin
Akhilesh Yadav25-Oct-06 19:50
Akhilesh Yadav25-Oct-06 19:50 
Questioncreate word document using asp vb script Pin
krishna1923-Oct-06 22:58
krishna1923-Oct-06 22:58 
Questionobtaining posted values using javascript Pin
gooseman11223-Oct-06 21:34
gooseman11223-Oct-06 21:34 
AnswerRe: obtaining posted values using javascript Pin
Talemin27-Oct-06 6:09
Talemin27-Oct-06 6:09 
AnswerRe: obtaining posted values using javascript Pin
RichardGrimmer1-Nov-06 5:13
RichardGrimmer1-Nov-06 5:13 
QuestionIs there any way to upload a file without using file upload control ????? Pin
jagmit2023-Oct-06 20:04
jagmit2023-Oct-06 20:04 
AnswerRe: Is there any way to upload a file without using file upload control ????? Pin
Guffa24-Oct-06 6:36
Guffa24-Oct-06 6:36 
AnswerRe: Is there any way to upload a file without using file upload control ????? Pin
Bradml26-Oct-06 23:31
Bradml26-Oct-06 23:31 
QuestionProblem with text wrapping Pin
Nitin198123-Oct-06 20:04
Nitin198123-Oct-06 20:04 
AnswerRe: Problem with text wrapping Pin
krishna1923-Oct-06 22:59
krishna1923-Oct-06 22:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.