/    Sign up×
Community /Pin to ProfileBookmark

insert items to al list

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd“>

<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
<title>script.aculo.us functional test</title>
<script type=”text/javascript” src=”../../lib/prototype.js”></script>
<script type=”text/javascript” src=”../../src/effects.js”></script>
<script type=”text/javascript” src=”../../src/dragdrop.js”></script>
<script type=”text/javascript”>
//<![CDATA[
var myStartEffect = function(element) {
element._opacity = Element.getOpacity(element);
new Effect.Opacity(element, {duration:0.2, from:element._
opacity, to:0.7});
new Effect.Highlight(element, {});
}
//]]>
</script>
<style type=”text/css”>
/*<![CDATA[*/
h1 {font-size: 1.2em; text-align:center;}
li {
margin: 5px auto;
padding: 2px;
width: 200px;
text-align:center;
list-style-type:none;
border: 2px solid #779;
background-color: #dde
}
div {
margin: 5px auto;
padding: 2px;
width: 300px;
text-align:center;
border: 2px solid #797;
background-color: #ded
}
/*]]>*/
</style>
<script type=”text/javascript” charset=”utf-8″>
var incVar = 3;
</script>

</head>

<body>
<h1>No delay sortable</h1>

<ul id=”sort1″>
<li recordid=”1″>one</li>

<li recordid=”2″>two</li>

<li recordid=”3″>three</li>

</ul>

<input name=”insert” type=”button” onClick=”$(‘sort1’).insert({bottom: ‘<li recordid=’ + Number(++incVar) + ‘> XXXXXXXXXXX </li>’}); Sortable.create(‘sort1’, {starteffect:myStartEffect});” />
<script type=”text/javascript” charset=”utf-8″>
Sortable.create(‘sort1’, {starteffect: myStartEffect});
</script>

<script type=”text/javascript” charset=”utf-8″>
function getOrder() {
var orderList = ”;
orderedNodes = document.getElementById(“sort1”).getElementsByTagName(“li”);
for (var i=0;i < orderedNodes.length;i++) {
orderList += orderedNodes[i].getAttribute(‘recordid’) + ‘, ‘;
}
alert(orderList);
}
</script>
<input name=”insert” type=”button” onClick=”getOrder()”/>

</body>
</html>
I want to insert an element like that ” <li id=”li_1″ >
<label class=”description” for=”element_1″>Text </label>
<div>
<input id=”element_1″ name=”element_1″ class=”element text medium” type=”text” maxlength=”255″ value=””/>
</div>
</li>” in XXXXXXXX
and then to be able to get the value from that….is that possible???

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@MrNobodyNov 28.2008 — ...is that possible???[/QUOTE]
Yes, you just use [B]document.createElement()[/B] to initially create the desired element, use [I]HTMLElement[/I][B].setAttribute()[/B] to update that new element's properties, and then use either the [I]HTMLElement[/I][B].appendChild()[/B] or [I]HTMLElement[/I][B].insertBefore()[/B] methods to add the element to the document at the desired location.

http://msdn.microsoft.com/en-us/library/ms536389(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms536739(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms535934(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms536454(VS.85).aspx
Copy linkTweet thisAlerts:
@d_psimauthorNov 28.2008 — Thank you very much..but i want to work also the effects that i have..is this possible?

Is there any guide with examples to all functions that i can read...??Some kind of examples tutorial...
Copy linkTweet thisAlerts:
@MrNobodyNov 28.2008 — I provided links to the four methods I mentioned -- which, by the way, are standard cross-browser methods. If you followed those links you would have seen that they include examples.
×

Success!

Help @d_psim 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 5.6,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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