Tag Archives: HTML

Javascript – Return to Previous URL

The following Javascript function will redirect you to the previous URL when it is called.

function goToPreviousPage() {
  history.go(-1)
}

 

Add a return button to your HTML page as follow.

<input type="button" name="returnButton" value="Return" onclick="history.go(-1);"/>

 

Done =)

Reference: Back to previous page

HTML – Remove Dotted Line of Transparent Button

Not only the HTML link will have a dotted outline after being clicked, if you have a transparent input button, you will find the dotted outline too.

 

The following css could help you to remove it.

/*for FireFox*/
input[type="submit"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner {   
  border : 0px;
} 
/*for IE8 */
input[type="submit"]:focus, input[type="button"]:focus {     
  outline : none; 
}

Continue reading HTML – Remove Dotted Line of Transparent Button

PHP – Convert Special Characters to HTML Entities

I was working on a legacy CMS which has a HTML form with ISO-8859-1 encoding. I found that whenever i got an Apostrophe (‘) in the string, the data cannot be persisted.

I guess it should be some encoding problem which makes the database fail to persist the data. So i try to use the PHP str_replace function to replace those Apostrophe but it has never replaced them successfully.

Finally, i got the solution. PHP provide a function called htmlspecialchars which will substitute the following special characters into HTML entities. Continue reading PHP – Convert Special Characters to HTML Entities