Alternative to using onfocus on a div to change border?

I've updated your jsFiddle so that it works the way you indicate you want, here's the code.

I've updated your jsFiddle so that it works the way you indicate you want, here's the code: window. Onload=function(){ var previewPanel = document. GetElementById('previewPanel'); var selection = "a", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "z"; for (var c in selection) { var newPreviewPanelEntry = document.

CreateElement('div'); newPreviewPanelEntry. Id = c; newPreviewPanelEntry. ClassName = "previewPanelEntry"; newPreviewPanelEntry.

AddEventListener('click',showIt); newPreviewPanelEntry. InnerHTML = "selection" + c + ""; previewPanel. AppendChild(newPreviewPanelEntry); } var newClear = document.

CreateElement('div'); newClear. ClassName = "clear"; previewPanel. AppendChild(newClear); function showIt(event) { var siblings = event.target.parentNode.

Children; for (var i=0; iBorder = "1px solid red"; var bigScreen = document. GetElementById('bigScreen'); bigScreen. InnerHTML = event.target.

InnerHTML; } } Some things to note: The jsFiddle wraps everything into a function which is called in the load event of the window, this is what that first line is. This has some consequences, one of which is.. None of your functions are global, they exist within the closure scope of the load event only, which means... You need to attach the event handlers in DOM rather than by adding onclick attributes, but, actually, you should be doing it that way anyway. I've used addEventListener for this, note that this won't work in older IE, you could also attach like newPreviewPanelEntry.

Onclick = showIt but this only allows for a single event listener per node. You hadn't created any of your global variables like previewPanel and bigScreen, so I added in code for that. There's no real need to add an onclick listener to every element in your array, just add the listener to previewPanel, the event will bubble up.

You can see this working here. The main trick with this approach is to make sure you're handling the event for the element you're interested in. For example, if you add further child elements to your clickable nodes, each of those child elements can trigger the click event.In this case, in addition to the check I used, you should probably check that the event.

Target has an id defined. I created a version which implemented your next and previous links, again the main trick is to add the handlers within the onload closure rather than as attrubutes.

Wow thank you. You answered my question, my extra credit jsfiddle question, and one I didn't ask. Wish I could give you 3 check marks.

– Jonathan Eckman yesterday.

Need the div to be selected and hold its border the entire time its selected, even if the mouse pointer moves off the specified div. – Jonathan Eckman 2 days ago yeah it will do even after mouse moves off because "onmouseout" is handled right. – dku.

Rajkumar 2 days ago.

If you create an anchor link around an object it should be focusable/tab-able... example: I can't tab to this text But I can tab to this text I haven't done HTML in a while but still, try it with a DIV, if not you can do it with something else like a SPAN and then edit the CSS properties to make it act like a DIV (i.e. Display: block;). Some other events you might be interested in: OnMouseOver (mouse hovers over object) OnMouseOut (mouse leaves object) OnClick (click once) OnMouseDown (half click) OnMouseUp (release click) OnFocus you already know OnBlur (the anti-focus) If you want to switch a DIV between two styles, it may be easier for you to do it with CSS, and only change the class field of the object.

Example: //style ... . Div-off { border: 1px solid black; } . Div-on { border: 1px solid #BBDDFF; background-color: #CCCCFF; } ... //script ... divList = new Array() {"div1","div2","div3"}; function switchStyle(obj) { for (i=0; idiv1 div2 div3.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions