Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - How to have two password fields controlled by one checkbox? -


<form>  <fieldset>  password: <span id="capsalert">caps lock = on</span><br>  <input type="password" id="pwd"> <script type="text/javascript">   document.write(     '<input type="checkbox" name="masking" onclick="unmask(this.checked)"> ' +      'show password type'    );  </script>  <br> password2:<br>  <input type="password" id="pwd2"> </fieldset>  </form>  <script type="text/javascript">  function chkcaps(e) {  ev = (e ? e : window.event);  kc = (ev.which ? ev.which : (ev.keycode ? ev.keycode : false));  sk = (ev.shiftkey ? ev.shiftkey : (ev.modifiers ? !!(ev.modifiers & 4) : false));  if(    (kc >= 97 && kc <= 122 && sk) ||   (kc >= 65 && kc <= 90 && !sk)  ) {    document.getelementbyid('capsalert').style.display = 'inline';  }  else {    document.getelementbyid('capsalert').style.display = 'none';  }//end if }//end function  function unmask(truefalse) {   oldelem = document.getelementbyid('pwd'); elem = document.createelement('input'); elem.setattribute('type', (truefalse == true ? 'text' : 'password')); elem.setattribute('value', document.getelementbyid('pwd').value); elem.id = 'pwd'; oldelem.parentnode.replacechild(elem,oldelem);  document.getelementbyid('pwd').onkeypress = function(e) { chkcaps(e); };  }//end function document.getelementbyid('pwd').onkeypress = function(e) { chkcaps(e); };  </script>   

i'm using above code in more complex form.

i have 2 separate "password" fields on form. current code can have first password field show characters typed when checkbox ticked.

also, code notifies user if typing caps lock enabled.

i have both password fields exhibiting same behavior rather first field only. unfortunately, not know how make happen.

thanks help.

edit:
simple solution might easier find following code. i'm willing use either one.

<script> function changetype() {     document.myform.pass.type=(document.myform.option.value=(document.myform.option.value==1)?'-1':'1')=='1'?'password':'text'; } </script>  <body> <form name="myform">    <input type="password" name="pass" />    <input type="password" name="pass2" />    <input type="checkbox" name="option" value='1' onchange="changetype()" /> </form> </body> 

why don't change type attribute of password inputs in unmask() function? way easier manage more 1 field. after checking whether have turn input text 1 or password one, this:

// suppose 'new_type' either 'text' or 'password' // , 'pwd' , 'pwd2' id attributes // both of password fields document.getelementbyid('pwd').type = new_type; document.getelementbyid('pwd2').type = new_type; 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -