Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Highlight

Highlights the fields when they get the focus


<script language="JavaScript1.2">
var highlightcolor="yellow"
var ns6=document.getElementById&&!document.all
var previous=''
var eventobj
//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/
//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}
//Function to highlight form element
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}
</script>
Prova a cliccare con il mouse sugli elementi del form
<br>
<FORM onkeyup=highlight(event) onclick=highlight(event)>
Campo 1:<INPUT size=25><BR>
Campo 2: <TEXTAREA name=S1 rows=5 cols=31></TEXTAREA>
<BR>
Campo 3:<INPUT type=checkbox><INPUT type=checkbox></SELECT>
<BR>
<INPUT type=button value="Form button">
</FORM>


Download the code...


Print


 

Inizio pagina

risorse per webmaster

dhtml

dhtml

dhtml, mail, forms,
dhtml, menu,

Vai nel sito Morpheusweb.it - Risorse per Webmaster troverai quello che stai cercando

dhtml, menu,
Nel nostro sito molte informazioni: "Morpheusweb.it - Risorse per Webmaster" tratta di dhtml, script, tendina, mail, forms
click here se non sei reindirizzato automaticamente al nostro sito.

dhtml, script, tendina, mail, forms, , ,