HTML CSS JS HTML CSS JS – My IT experience

Child resize according to parent resize

It is incredible how well nowadays browsers handle resizing of elements.

The simplest way you could get a resize on a child element when the parent has been resized is to create two css rules:


.parent {
width:100px;
height: 50px;
}

.child {
position: absolute;
width:100%;
height:100%;
}

Of course the parent element should contain the child element.

How to style a file form field?!

After an agonizing evening of research and tests solution was finally found. Simplest way to edit a file form field style is inserting the following css code in you css style:

input[type=”file”] {
text-align: right;
opacity: 0.8;
font-size:9px;
float:left;
max-width:400px;
size:10;
}

Replace “file” part with any field name you want to edit its style easily.

Javascript code to match 24 hour format hh:mm

Here is a simple Javascript time checker.

Javascript code:

$(document).ready(function() {
$("#checkTime").submit( function() {
if(!$("#timeElementId").val().match(/^([0-1][0-9]|2[0-3])(\D*)([0-5][0-9])$/))
{
var message = 'Time should be in the following format
' +
'hh:mm, hh:00-23, mm:00-59';
alert(message);
return false;
}
}
}

HTML code:

The expression inside the match function is good enough for a pattern within a html5 field validation.
Neat HTML5 code (at this moment not working with all browsers):


WordPress hacked – through get_footer funtction

Recently I have noticed that my wordpress blog was abused by spam links showing at the bottom of the page and beneath the sidebar.

After couple of tests I came to realise that the spam links where somehow embedded in the get_footer() function, which is called at the last line of your Main Index Template, Page Template and Single Post template. The function itself is located in wp-includes/general-template.php.

However the easiest way to get rid of the hacked get_footer is update your wordpress to the latest version or reinstall your current version. After completing this step it is strongly recommended that you change your passwords for accessing wp-admin and ftp.

Categories