Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Thursday, May 26, 2011

Open window in a new browser

There are times when you want to open web page in a new window/browser using Javascript. Before we discuss javascript solution, let me share other ways as well to open new pages using clientend.
It cant get any simpler than this
To view all my post, pleace click here
Code <a href="http://www.qaziarfeen.blogger.com" >here </a>
Code <a href="http://www.qaziarfeen.blogger.com" target="_blank" >here </a>

Using Button
Instead of hyperlinks, we can use HTML buttons as well and make them behave the same way as hyperlinks

Use the following code to test the behaviour to open page in the same window

<input id="btOpen1" type="button" value="Home" onclick="return ClearUrl();" />

<script type="text/javascript" >
function ClearUrl() {

window.location.href = "www.google.com";
}
</script>



Use the following code to test the behaviour to open page in a new window
<input id="btOpen1" type="button" value="Home" onclick="return ClearUrl();" />
<script type="text/javascript" >
function ClearUrl() {
window.open('http://qaziarfeen.blogspot.com'_blank');
}
</script>

Tuesday, April 19, 2011

HTML iframe tag

iframe or inline-frame can be added to your html in the following way. <iframe src="http://www.google.com"> </iframe>
Other attributes of IFRAME are


align: left; right; top; middle; bottom
Deprecated. Use styles instead.Specifies the alignment of an iframe according to surrounding elements
height: pixels; %
Specifies the height of an iframe
name: name
Specifies the name of an iframe
scrolling: yes; no; auto
Specifies whether or not to display scrollbars in an iframe
src: URL
Specifies the URL of the document to show in an iframe
width: pixels; %
Specifies the width of an iframe



Reference http://www.w3schools.com/