This is a discussion on How to indimate a link is opened or not? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all, I'm creating a html page..there is lot of links..I need to check the links opened ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi all, I'm creating a html page..there is lot of links..I need to check the links opened or not. check my coding, <html> <head> <title></title> </head> <body> <A HREF="http://google.com" TARGET="NewTarget" onClick="window.focus() Window.open('http://google.com', 'NewTarget') return false;"> Google</A> <br/> <A HREF="http://gmail.com" TARGET="NewTarget" onClick="window.focus() Window.open('http://gmail.com', 'NewTarget') return false;"> Gmail</A> <br/> <A HREF="http://yahoo.com" TARGET="NewTarget" onClick="window.focus() Window.open('http://yahoo.com', 'NewTarget') return false;"> Yahoo</A> <br/> <A HREF="http://Discussweb.com" TARGET="NewTarget" onClick="window.focus() Window.open('http://Discussweb.com', 'NewTarget') return false;"> Discussweb</A> <br/> <A HREF="http://msn.com" TARGET="NewTarget" onClick="window.focus() Window.open('http://msn.com', 'NewTarget') return false;"> MSN</A> <br/> </body> </html> This code doesn't work...I'm not knowing where I'm wrong... Is there any Idea?
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
|
#2
| |||
| |||
| So you want to open a new window for each link? If that is the case, you would need to name each window differently. eg Window.open('http://your link', 'Name1'); Window.open('http://your link', 'Name2'); etc... I think this is what you mean? If not let me know in a bit more detail.
__________________ cheers Aman |
|
#3
| |||
| |||
| Thank u buddy, Each link should open in a same named target window, thats y i gave the same target name for each link. The problem is first time if u click any one of the link it will open a new window, after second time it will open the same window, but we dont know whether it is opened or not, so i need to indicate to the user link that named browser blinking in taskbar or appear on the screen. It will help to user to know whether the new link is opened. the function Window.focus() will help to do this. I tried, but i didn't get result.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
|
#4
| |||
| |||
| Hi buddy, Use as follows, Code: <html>
<head>
<title></title>
<script type="javascript">
var newWindow = false;
function toggleWindow(url)
{
// Check if window is or has been open already and make sure it has not been closed
if (newWindow && newWindow.open && !newWindow.closed)
{
// Change the URL and give the window focus
newWindow.location.href = url;
newWindow.focus();
} else {
// Otherwise open the window and give it focus
newWindow = window.open(url, 'newWindow');
newWidnow.focus();
}
}
</script>
</head>
<body>
<!-- Now put the function call on each linke //-->
<A HREF="http://google.com" TARGET="NewTarget" onClick="toggleWindow('http://google.com') return false;">
Google</A>
<br/>
<A HREF="http://gmail.com" TARGET="NewTarget" onClick="toggleWindow('http://gmail.com') return false;">
Gmail</A>
<br/>
<A HREF="http://discussweb.com" TARGET="NewTarget" onClick="toggleWindow('http://discussweb.com') return false;">
discussweb</A>
<br/>
<A HREF="http://yahoo.com" TARGET="NewTarget" onClick="toggleWindow('http://yahoo.com') return false;">
Yahoo </A>
<br/>
<A HREF="http://msn.com" TARGET="NewTarget" onClick="toggleWindow('http://msn.com') return false;">
msn</A>
<br/>
</body>
</html>
__________________ cheers Aman |
|
#5
| |||
| |||
| Thanks for send this code. But code is not focussing the inactive (minimized) window.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
|
#6
| |||
| |||
| The function from my last post does the same thing as the code you posted. The call to newWindow.focus() is the only thing I know and it doesn't work on all browsers/OS etc. You would be better off closing the window and opening again each time you run the function. Code: var newWindow = false;
function toggleWindow(url)
{
// Close3 the window if its already open.
if (newWindow && newWindow.open && !newWindow.closed)
{
newWindow.close();
}
newWindow = window.open(url, 'newWindow');
newWidnow.focus();
}
__________________ cheers Aman |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The theme is opened completely and very actual! | BKOsuper | Server Management | 0 | 12-04-2008 12:08 AM |
| How to move a PopUp div to be opened at desired location? | poornima | ASP and ASP.NET Programming | 2 | 03-17-2008 07:50 PM |
| html link with Php | Archimedees | PHP Programming | 1 | 09-11-2007 03:05 AM |
| Three Way Link Exchange? | Joe | Search Engine Optimization | 0 | 02-23-2007 06:07 AM |
Our Partners |