Jump to content
php.lv forumi

login formas


ziedinjsh

Recommended Posts

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>

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

š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 by 2easy
Link to comment
Share on other sites

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" />

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...