myGully.com

myGully.com (https://mygully.com/index.php)
-   Programmierung (https://mygully.com/forumdisplay.php?f=67)
-   -   Html / javascript Frage mit Formular (https://mygully.com/showthread.php?t=2072115)

LordPresten 04.07.10 16:51

Html / javascript Frage mit Formular
 
hi Leute,

ich habe ein Frage.

NUn ich habe ein Formular, in dem steht am Anfang (wenn man die Seite läft immer ein http:// )
nach dem http:// kann man dann seine Internetaddresse angeben.

Wenn man dann aber eine Seite eingetragen hat ( wird die Seite nicht neu geladen) und das http:// ist weg.

Könnte mir jemand helfen, und zwar so , dass das http:// nach dem eintragen einer Seite immer da bleibt!


Hier ist das http:// noch da!
http://i46.tinypic.com/12576a9.jpg




Jetzt gebe ich die Addresse zu Ende ein!
http://i49.tinypic.com/2jdnp7p.jpg



Jetzt Trage ich die Seite ein. UNd das http:// ist weg

Ich möchte es aber immer dahaben




http://i46.tinypic.com/35it7p3.jpg


Brauche dringend HILFE!

allar 04.07.10 19:04

Mit S***** wäre es einfacher.

Anscheinend löscht du den Eintrag der Textbox nachdem auf Senden geklickt wurde.
Nach dem Löschen einfach wieder ein 'http:' reinsetzen (bzw gar nicht löschen und gleich reinsetzen)

LordPresten 04.07.10 21:34

ich poste den S***** morgen

LordPresten 05.07.10 18:37

so der HTml Code:

Zitat:

<div id="sitesbox">

<form id="addTask">
<div id="title">Seite eintragen</div>

<input type="text" id="newTask" value="http://" />
<input type="submit" value="Seite eintragen" />

</form>


<div id="listArea">

<div id="title">Deine Seiten</div>

<ol id="todo"></ol>

</div>

</div>
und hier der Javas***** Code:


Zitat:

window.addEvent('domready', function() {

//This is the function that will run every time a new item is added or the
//list is sorted.
var showNewOrder = function() {
//This function means we get serialize() to tell us the text of each
//element, instead of its ID, which is the default return.
var serializeFunction = function(el) { return el.get('text'); };
//We pass our custom function to serialize();
var orderTxt = sort.serialize(serializeFunction);
//And then we add that text to our page so everyone can see it.
$('data').set('text', orderTxt.join(' '));
};

//This code initalizes the sortable list.
var sort = new Sortables('.todo', {
handle: '.drag-handle',
//This will constrain the list items to the list.
constrain: true,
//We'll get to see a nice cloned element when we drag.
clone: true,
//This function will happen when the user 'drops' an item in a new place.
onComplete: showNewOrder
});

//This is the code that makes the text input add list items to the <ul>,
//which we then make sortable.
var i = 1;
$('addTask').addEvent('submit', function(e) {
e.stop();
//Get the value of the text input.
var val = $('newTask').get('value');
//The code here will execute if the input is empty.
if (!val) {
$('newTask').highlight('#f00').focus();
return; //Return will skip the rest of the code in the function.
}
//Create a new <li> to hold all our content.
var li = new Element('li', {id: 'item-'+i, text:val});
//This handle element will serve as the point where the user 'picks up'
//the draggable element.
var handle = new Element('div', {id:'handle-'+i, 'class':'drag-handle'});
handle.inject(li, 'top');
//Set the value of the form to '', since we've added its value to the <li>.
$('newTask').set('value', '');
//Add the <li> to our list.
$('todo').adopt(li);
//Do a fancy effect on the <li>.
li.highlight();
//We have to add the list item to our Sortable object so it's sortable.
sort.addItems(li);
//We put the new order inside of the data div.
showNewOrder();
i++;
});

});

urga 05.07.10 19:13

Code:

//Set the value of the form to '', since we've added its value to the <li>.
$('newTask').set('value', '');

dann probier mal stattdessen ein:
Code:

$('newTask').set('value', 'http://am-besten-lerne-ich-mal-javascipt-und-jquery.de');
;)

LordPresten 06.07.10 16:59

Danke :)


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:25 Uhr.

Powered by vBulletin® (Deutsch)
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.