affiliate_link
Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Tuesday, July 5, 2011

Displaying iFrame content in a DIV

if your images are outside of your iFrame, of course your dropdown menu will not show up since you are trying to tell the dropdown menu to go out of its windows. iframe is a different window inside your html, therefore any overflow of the window will never go out, elements inside the iframe is not affected with the z-index.

what you could do is, if your http://website.com/dropdown.html has the dropdown content only, you can call it by jQuery

<div id="myDropDown">
</div>


<script type="text/javascript">
    $(document).ready(function() {
        $("#myDropDown").load("http://website.com/dropdown.html");
    });  
</script>

this will append the content of your dropdown.html into the div

Tuesday, June 16, 2009

How Can I Use Javascript to Allow Only Numbers?

function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;

return true;
}

Add the following to the onkeypress event of your text box

return isNumberKey(event)

Monday, October 6, 2008

Getting screen resolution of client machine

Sometimes it is required to display to webpage according to the screen resolution of the client computer. It can be done easily in javascript using screen object of the window object.

Javascript code snippet

var width = window.screen.width;

var height = window.screen.height;