We can do this by using window.location.href
<body onload="javascript:window.location.href='http://yoursite.com//filename.zip';">
<body onload="javascript:window.location.href='http://yoursite.com//filename.zip';">
div{ width: 140px; height: 140px; border: 1px solid #f00; text-align: center; vertical-align: middle; display: table-cell; }Note: display: table-cell; supports IE8+
<div> <img src="http://www.htmlgoodies.com/img/2010/11/jquery.jpg" /> </div>jQuery
<script type="text/javascript"> $(function(){ var max_size = 130; $("div img").each(function() { if ($(this).height() > $(this).width()) { var h = max_size; var w = Math.ceil($(this).width() / $(this).height() * max_size); } else{ var w = max_size; var h = Math.ceil($(this).height() / $(this).width() * max_size); } $(this).css({'height': h, 'width': w}); }); }); </script>
<div class="styleFileInput">
<input type="text" class="browseText" /> //will work as file text field
<input type="button" value="Browse" class="browseButton" /> // will work as browse button
<input type="file" size="1" class="theFileInput" /> // Actual input type file which has opacity: 0
</div>
.styleFileInput{
position: relative;
}
.browseButton{
border: 1px solid #b1902c;
font-size: 0.9em;
color: #fff;
padding: 3px 8px;
border-radius: 4px;
background: #a7851c;
}
.browseText{
width: 150px;
margin: 0 48px 0 0;
padding: 2px 0;
}
input.theFileInput{
position:absolute;
top:0px;
left: 156px;
opacity:0;
-moz-opacity:0;
filter:alpha(opacity:0);
z-index:2;
width:80px;
font-size: 1em;
}
$('input[type="text"]').keypress(function(e){
e.preventDefault();
});
$('.theFileInput').change(function(){
$('.browseText').val($(this).val());
});
// if condition for Webkit and IE
if($.browser.webkit || $.browser.msie){
$('.theFileInput').css('left', '190px');
}
<div>
<img src="http://www.isanam.com/scraps/hi-hello/hi-hello-21.gif" />
</div>
div{
width: 500px;
height: 500px;
border: 1px solid #f00;
text-align: center;
display: table-cell;
vertical-align: middle;
}
<input type="text" value="Edit me" readonly="readonly" /> <input type="button" value="Make Editable" class="makeEditable" /> <input type="button" value="Make Non Editable" class="makeNonEditable" />The jQuery
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript"> $(function(){ $(".makeEditable").click(function(){ $('input:text').removeAttr("readonly"); }); $(".makeNonEditable").click(function(){ $('input:text').attr("readonly", "readonly"); }); }); </script>Demo: http://jsfiddle.net/jmuh3yzo/