so i've got lightbox on website there's link within.
when user clicks link gets taken domain.com/sub#target
the targeted area quite small it's important highlight it.
this how far i've gotten:
jsfiddle: http://jsfiddle.net/mt9z6d7k/1/
function focuss (id) { var divs = document.getelementsbyid('u_0_3'); var count = divs.length; (var = 0; < count; i++) { if (divs[i].classname == 'focus_div'){ divs[i].onclick = highlight(id); } } } function highlight(id) { document.getelementbyid(id).style.bordercolor = '#ff0000'; } the solution must in javascript unfortunately. if me appreciate much!
document.getelementsbyid not js function.
if want target multi elements id, use document.queryselectorall('#u_0_3').
i must warn you, valid html doesn't allow repeat same id on multiple elements. suggest use class, focus_div above, doing document.queryselectorall('.focus_div') or document.getelementsbyclassname('focus_div').
here's working fiddle using multiple ids: http://jsfiddle.net/7g4t9yxo/1/
notice add focuss('u_0_3'); end activate behavior.
Comments
Post a Comment