How to open the new tab

Posted by Kapsystem under ASP.NET on 7/4/2011 | Points: 10 | Views : 5328 | Status : [Member] | Replies : 2
Hi..

Am using asp.net.

How to open the new tab at the time of button click?

Can any one tell me the solution.

Thanks in advance.




Responses

Posted by: SheoNarayan on: 7/4/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Here is a demo code snippet, copy-paste into a plain text file with .htm extension and open into browser. Click on the button and it should open www.itfunda.com in a new window

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title></title>
<script type="text/javascript">
function OpenNewPage() {
window.open('http://www.itfunda.com', "", "");
}
</script>
</head>
<body>
<input type="button" name="btn" id="btn" value="Click to open page in new tab" onclick="OpenNewPage()" />
</body>
</html>


Here we have a button, on click of the button we are calling OpenNewPage javascript function. In that function, we are using the window.open method by passing the url to open the web page.

More details on window.open are at http://www.dotnetfunda.com/codes/code84-how-to-open-a-new-window-in-javascript-.aspx .

Hope this helps.

Thanks


Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kapsystem, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kapsystem on: 7/4/2011 [Member] Starter | Points: 25

Up
0
Down
Its working fine.

Thanks for your response.




Kapsystem, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response