The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Yes, that can be done with little trouble. I wouldn't use onclick attributes though, and the buttons shouldn't be in the html code itself, for what happens when javascript is not supported? Those buttons then become meaningless and confusing.

So let's get rid of them from the html and create them from javascript instead.

What is that createElement() function? That's something I whipped up to make creating elements a whole lot easier. Creating elements often takes quite a few statements, so with the createElement() function it becomes just a one-liner.

The createElement() function that makes the job of creating elements a whole lot easier, so instead of duplicating a lot of lines to create elements and their parts, this is the function that's used instead.

When moving elements, we are going to be checking for the previous and next element, and as I'm not aware of an easy way to go through just the tag elements, we're going to have to deal with the text elements that contain the whitespace around the tags as well. So we'll use some helper functions, uptoElement(), previousTag(), nextTag(), and lastTag()

first, thanks for the examples guys. Since I know ahead of time the browsers accessing this page will have javascript turned on, generating the buttons via javascript just ended up being way too complex.

Anyway, I took this a few steps further using mrhoo's example.

Bascially, I now have a remove button in addition to the move up and down buttons.

Also, I have a separate input id "mediaorder" to keep track of what's been moved and what's been removed.

While this seems to work in firefox, this doesn't work at all in IE6. I'm not sure why, since mrmoo's original script worked in both IE and firefox.