Regular Expression in Java to Strip HTML Tags; just for my own reference:
sMyString = sMyString .replaceAll("\\<.*?>","");
Programming solutions, source code, solutions to tech problems and other tech related stuff.
Showing posts with label html. Show all posts
Showing posts with label html. Show all posts
Friday, September 05, 2008
Sunday, January 27, 2008
How to dynamically change the height of an IFRAME in both Firefox and IE
Based on various code snippets that I found on the Internet, here is how to do it:
(Please contact me if you are the original author of the functions)
function getDocHeight(doc) {
var docHt = 0, sh, oh;
if (doc.height) {
docHt = doc.height;
}
else if (doc.body) {
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh, oh);
}
return docHt;
}
function fnResizeIframe(sIFrameName) {
var iframeWin = window.frames[sIFrameName];
var iframeEl = window.document.getElementById? window.document.getElementById(sIFrameName): document.all? document.all[sIFrameName]: null;
if ( iframeEl && iframeWin ) {
iframeEl.style.height = "auto";
var docHt = getDocHeight(iframeWin.document);
if (docHt) iframeEl.style.height = docHt + "px";
}
else { //firefox
var docHt = window.document.getElementById(iframeName).contentDocument.height;
window.document.getElementById(iframeName).style.height = docHt + "px";
}
} //end of function getDocHeight(doc)
(Please contact me if you are the original author of the functions)
function getDocHeight(doc) {
var docHt = 0, sh, oh;
if (doc.height) {
docHt = doc.height;
}
else if (doc.body) {
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh, oh);
}
return docHt;
}
function fnResizeIframe(sIFrameName) {
var iframeWin = window.frames[sIFrameName];
var iframeEl = window.document.getElementById? window.document.getElementById(sIFrameName): document.all? document.all[sIFrameName]: null;
if ( iframeEl && iframeWin ) {
iframeEl.style.height = "auto";
var docHt = getDocHeight(iframeWin.document);
if (docHt) iframeEl.style.height = docHt + "px";
}
else { //firefox
var docHt = window.document.getElementById(iframeName).contentDocument.height;
window.document.getElementById(iframeName).style.height = docHt + "px";
}
} //end of function getDocHeight(doc)
Sunday, July 22, 2007
CSS. Right Aligning a Background Image
background-repeat: no-repeat;
background-attachment: fixed;
background-position: top right;
background-attachment: fixed;
background-position: top right;
Thursday, August 17, 2006
Hiding all Checkboxes on a HTML Page with Javascript
Iterating through all the checkbox elements on a page using the javascript getElementsByTagName() command.
var inputs = window.document.getElementsByTagName('input');
for(var i=0; i < inputs.length; i++){ //iterate through all input elements
if (inputs[i].type.toLowerCase() == 'checkbox') { //if the element is a checkbox
inputs[i].style.display = "none";
}
}
var inputs = window.document.getElementsByTagName('input');
for(var i=0; i < inputs.length; i++){ //iterate through all input elements
if (inputs[i].type.toLowerCase() == 'checkbox') { //if the element is a checkbox
inputs[i].style.display = "none";
}
}
Subscribe to:
Posts (Atom)