Hello Guru's
I need your help,
As you can see below, I will end up having a huge list of code to accomplish an onblur and on focus scenario for a div and an input field. Is there a way to create a "list" and loop through it to accomplish what this code does line by line? Since I will have over 20 fields the page of code will be quite long.
An ideal list would be:Code:document.getElementById('f1').onfocus = function() { document.getElementById('f1').style.border = '1px solid #0033CC' document.getElementById('div_rssims_prefix').style.color = '#0033CC' } document.getElementById('f1').onblur = function() { document.getElementById('f1').style.border = '1px solid #ABADB3' document.getElementById('div_rssims_prefix').style.color = '' } document.getElementById('f2').onfocus = function() { document.getElementById('f2').style.border = '1px solid #0033CC' document.getElementById('div_rssims_firstname').style.color = '#0033CC' } document.getElementById('f2').onblur = function() { document.getElementById('f2').style.border = '1px solid #ABADB3' document.getElementById('div_rssims_firstname').style.color = '' } document.getElementById('f3').onfocus = function() { document.getElementById('f3').style.border = '1px solid #0033CC' document.getElementById('div_rssims_middlename').style.color = '#0033CC' } document.getElementById('f3').onblur = function() { document.getElementById('f3').style.border = '1px solid #ABADB3' document.getElementById('div_rssims_middlename').style.color = '' }
ect.Code:f1,div_rssims_prefix f2,div_rssims_firstname f3,div_rssims_middlename



Reply With Quote

Bookmarks