What are pseudo classes?
Pseudo-classes are fictional element types that do not exist in HTML. For eg : by creating fictional types of the A element individual style can be applied to each class The three fictional element types are: A as unvisited link, A as active link and A as visited link. Pseudo-classes can be created by a colon followed by pseudo-class’s name as: A:link {background: cyan; color: blue} A:active {background: transparent; color:black} A:visited {background: cyan; color: red} Click Here
What are pseudo-elements?
Pseudo-elements are fictional elements that do not exist in HTML. They address the element’s sub-part. There are 2 types of pseudo-elements as “first-line pseudo-element’ and ’first-letter pseudo-element’. Pseudo-element is created by a colon followed by pseudo-element’s name,e.g: P:first-line H1:first-letter and can be combined with normal classes; e.g: P.initial:first-line The first line of this paragraph will be displayed in uppercase letters
How can the styles be applied for the TD for OnMouseOver & OnMouseOut events?
The styles can be changed for the onmouseover and onmouseout events for the TD tags as shown below. Td.mouseout { background-color: #FAEBD7; BORDER-RIGHT: maroon thick double; BORDER-TOP: maroon thick double; BORDER-LEFT: maroon thick double; BORDER-BOTTOM: maroon thick double; MARGIN: 1px; color: #FFFFFF; } Td.mouseover { background-color: #FFFFFF; color: #000000; } <table width=”100%”> <tr> <td class=”mouseover” onmouseover=”className=’mouseout’;” onmouseout=”className=’mouseover’;”> Styles applied for onmouseover & onmouseout </td> </tr> </table>
How can the ‘Enter’ key be disabled?
In order to avoid the Form Submission by pressing the ’Enter Key’ you have to write following code on the KeyPress Event Of the Body Tag function DisableEnterKey() { if (window.event.keyCode == 13) { event.returnValue=false; event.cancel = true; } } <body onkeydown=”DisableEnterKey();”>
Is there Trim function available in Javascript?
There is no predefined trim function available. The function written below is used to Trim white spaces. //Trim Function function LTrim(str) { var whitespace = new String(‘ \t\n\r’); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { var j=0, i = s.length; while (j < i && whitespace.indexOf(s.charAt(j)) != -1) j++; s = s.substring(j, i); } return s; } function RTrim(str) { var whitespace = new String(‘ \t\n\r’); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { var i = s.length – 1; while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i–; s = s.substring(0, i+1); } return s; } function Trim(str) { return RTrim(LTrim(str)); }