ziedinjsh Posted April 1, 2010 Report Share Posted April 1, 2010 ir kāds java vai ajax scripts kurš formās rāda piemēram: Jūsu e-pasts ieklikšķinot formā teksts pazūd un var rakstīt savu e-pastu un tā pat arī parolei? Paldies jau iepriekš :) Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted April 1, 2010 Report Share Posted April 1, 2010 http://fuelyourcoding.com/in-field-labels/ Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 speciāli tev, par drosmi šajā dienā uzdot jautājumus ;) tas nav ne java, ne ajax, taču ir! kr4 paņēmu 1x funkciju no savas bibliotēkas :)) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head><body> <input type="text" id="email" name="email" /> <script type="text/javascript"> function ctlvdef(sId, v) { // control value default var o = document.getElementById(sId); if (!o.value) o.value = v; o.onfocus = function () {if (this.value == v) this.value = "";}; o.onblur = function () {if (this.value == "") this.value = v;}; } ctlvdef("email", "Tavs e-pasts"); </script> </body></html> Quote Link to comment Share on other sites More sharing options...
codez Posted April 1, 2010 Report Share Posted April 1, 2010 tikai nelieciet šito fīču search laukā. Tā citrei gribās ar peli iezīmētu tekstu ievilkt inputā, bet tur jau stāv "search" un abi draudzīgi apvienojas. Quote Link to comment Share on other sites More sharing options...
waplet Posted April 1, 2010 Report Share Posted April 1, 2010 kpc lai nevarētu likt? Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 tpc ka codezam ir aprīlis iestājies :P Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 1, 2010 Author Report Share Posted April 1, 2010 Paldies! <script type="text/javascript"> function ctlvdef(sId, v) { // control value default var o = document.getElementById(sId); if (!o.value) o.value = v; o.onfocus = function () {if (this.value == v) this.value = "";}; o.onblur = function () {if (this.value == "") this.value = v;}; } ctlvdef("email", "Tavs e-pasts"); </script> šo es ieliku head un šādi izskatās forma echo "<input type='text' id='email' name='email' class='login-box'>"; bet man ir tukša forma nekas nerādās! Quote Link to comment Share on other sites More sharing options...
codez Posted April 1, 2010 Report Share Posted April 1, 2010 kpc lai nevarētu likt? Tu izlasīji manu postu līdz galam? Tur bija rakstīts, kāpēc nevajag likt. Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 (edited) šo rindiņu: ctlvdef("email", "Tavs e-pasts"); vajag aiz texta lauka echo "<input type='text' id='email' name='email' class='login-box'>"; echo '<script type="text/javascript">ctlvdef("email", "Tavs e-pasts");</script>'; Edited April 1, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
codez Posted April 1, 2010 Report Share Posted April 1, 2010 Ar jquery: <script> $(function(){ $('.c') .focus(function(){if($(this).val()==$(this).attr('val')){$(this).val('');}}) .blur(function(){if($(this).val()==''){$(this).val($(this).attr('val'))}}); }); </script> <input type="text" value="Username" val="Username" class="c" /> <input type="text" value="Email" val="Email" class="c" /> <input type="text" value="City" val="City" class="c" /> Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 triviālas lietas es labāk uzkodēju pats ar pure js bez visādiem jquery ;) Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted April 1, 2010 Report Share Posted April 1, 2010 Triviālās lietas vispār nav vajazības sarežģīt ar JS ;) Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 arī fakts ;) Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 1, 2010 Author Report Share Posted April 1, 2010 es zinu ka nev īstais topiks, bet gribu pajautāt vai kāds nezin kādu ajax animētu div slaideri vai feidout.. piem. uzspiežu uz teksta vai bildes un apakšā parādās teksts, uz spiež atkal pazūd teksts. Tā kaut kā! :) e sjau te esmu izgooglojis, iot kā var atrast kko, bet neviens man neiet.. Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 (edited) nju gan tevi var droši redirektot uz jquery :D:D:D http://api.jquery.com/category/effects/ Edited April 1, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.