Sunday, 20 October 2013

HTML - How can I open multiple links/windows with a single anchor tag using Javascript

Hi friends, in this article I will explain about HTML - How can I open multiple links/windows with a single anchor tag using Javascript
I already explained in the previous articles about Numeric Validation: How to allow numbers, backspace, delete, left and right arrow and Tab Keys to the TextBox using Javascript or JQuery in ASP.NETHow to disable/Prevent/Don’t allow the User from Entering HTML tags in Textbox/TextArea and How to Compare Start Date and End Date and Validate in YYYY-MM-DD Format in ASP.NET

In ASP.NET:
<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>HTML - How can I open multiple links/windows with a single anchor tag using Javascript</title>
    <script language="javascript " type="text/javascript" >
        function OpenAllLinks() {
            var a1 = "http://google.com";
            window.open(a1);
            var a2 ="http://aspdotnet-kishore.blogspot.com";
            window.open(a2);
            var a3 = "http://autolisp-kishore.blogspot.com";
            window.open(a3);
            var a4 = "http://aspdotnet-kishore.blogspot.in/search/label/ASP.NET";
            window.open(a4);
            var a5 = "http://aspdotnet-kishore.blogspot.in/search/label/VB.NET";
            window.open(a5);
            var a6 = "http://aspdotnet-kishore.blogspot.in/search/label/MVC";
            window.open(a6);
            var a7 = "http://aspdotnet-kishore.blogspot.in/search/label/CSharp";
            window.open(a7);
            var a8 = "http://aspdotnet-kishore.blogspot.in/search/label/Sql%20Server";
            window.open(a8);           
    }

</script>
</head>
<body>
<a href="http://www.google.com/" onclick ="OpenAllLinks();" target ="_blank" >Open All Links</a>
</body>
</html>

The output of the above code as shown in the below figure.
when you click on OpenAllLinks link then all URLs will be open in new tabs.

No comments:

Post a Comment

© 2012-2018 Aspdotnet-Kishore.blogspot.com. All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.