Blog: Tag Archives: HTML

HTML – Embed flash (W3C Compliant)

Posted On:

<object type="application/x-shockwave-flash" data="images/swifs/ag_cat2006ani.swf" width="103" height="60">
<param name="movie" value="images/swifs/ag_cat2006ani.swf">
<param name="bgcolor" value="#ffffff">
<param name="menu" value="false">
<param name="quality" value="high">
<b>No flash</b>
<br>Please install the <a href="http://www.macromedia.com/go/getflashplayer" target="_blank">FLASH plugin</a>.
</object>		

Jvascript – Max Length of Text area

Posted On:

// Max Length for Text areas

function imposeMaxLength(AreaName, MaxLen)
{
 var limit = MaxLen;  
 var text = AreaName.value; 
 var chars = text.length; 
	if(chars > limit){  
             var new_text = text.substr(0, limit);  
				AreaName.value = new_text;  
	}
	document.getElementById('TextCountRemain').innerHTML = limit - chars;
}

<!-- HTML -->

textarea rows="5" cols="60" onkeypress="imposeMaxLength(this, 250);" name="NewsOutlineText" id="NewsOutlineText"></textarea>

<div id="MaxLenMeasure">Characters Left: <span id="TextCountRemain">250</span></div>


<script type="text/javascript">
//Update the amount of characters left for the news outline
imposeMaxLength(document.EditNews.NewsOutlineText, 250);
</script>

Javascript – resize iframe based on content

Posted On:

The following will resize the iframe based on the height of the page being pulled into it – but it will only work if the page you’re pulling into the iframe is stored on the same server/PC as the page containing it.

<html>
<head>
<title>Resizeable Iframe Example</title>
<script type="text/javascript">
function loadframe()
{
var frame1="";
frame1 = document.getElementById('NewsFrame1');

     if(frame1!=null)
     {
         //alert(frame1.contentWindow.document.body.scrollHeight);
         frame1.style.height = frame1.contentWindow.document.body.scrollHeight + "px";
     }
}
</script>


</head>
<body onload="loadframe()">
<p>This is a page with some iframes in it </p>
<h1> Frame 1</h1>
<iframe src="test2.html" style="height: 272px;width:100%;border:1px solid red" id="NewsFrame1" name="NewsFrame1" frameborder="0" border="0" scrolling="no"></iframe>


</body>
</html>