Forum Moderators: open
As a supposed means of SEO, I am going to put hyperlinked keywords below each of the titles in my tutorial pages, linking to the dictionary elaborated upon in the page content. I am doing this because
1. It points out the functionality of the dictionary on the site (to be used in conjunction with tutorials)
2. It adds more prominence to the keywords associated with that page
3. It helps the search engines to reach the data hidden within my database
So all is good
The thing is, if someone is going to be reading the tutorial, they will want the terms to be in a new window when they click on them. So do sort this, i use the _blank attribute to the hyperlink. The thing is, if i have 10 links to the dictionary, I do not want the user to have to have open 10 browser windows. Preferably, by clicking one and opening the term in the new window, I would want the other 9 to load up in that window!
I have seen this done before and am sure that someone in here knows what Im on about.
Info very much appreciated!
LAN
The thing is, you also want the spiders to follow the links, and they won't read the variables in a javascript pop-up function. So, assuming your pop-up function is popUp(url,windowname), use this format for your links:
<a href="dictionary.html" onClick="popUp('dictionary.html','dict');return false;">
Don't forget the "return false" -- it keeps your main window from loading the new document.
I've been using this on several sites, and it works well. It also provides access to the dictionary page for visitors who have js turned off.
Set the target attribute to TARGET="dictionary" and if there is no open window already called "dictionary it will open a new window just like TARGET="_blank" does. However, if there is already a window opened this way called "dictionary" (i.e. they still have that last new window open somewhere) it uses that same window as the target.
Case solved.
Ammon Johns
dictionary.asp?Term=Cell
dictionary.asp?Term=Chromosome etc
Tedster, I tried you approach, thanks for the pointer, the thing is, they dont load up in a new window, they load up in the same window.
Even if I use the _blank attribute, they all open up in different windows, which defeats the purpose
example of my link
(a href="http://www.biology-online.org/dictionary.asp?Term=Cell" onClick="popUp('dictionary.asp','dict');return false;" target="_blank">Cell</a)
(changed the opening n endingg tags in case they are rendered)
so what alterations are required? Thanks for the info so far peeps :)
Richard
Not quite clear what you mean here. I thought you wanted your user to only have one new window no matter how many terms were clicked.
If you do want to load the link in a new window, you can use a different window name for the second parameter in the function. (i.e. 'dict1', 'dict2' etc.) The ;return false; section should keep the document from loading in your main window.
Maybe there's a complication with ASP that I'm not aware of. That's not an area I play with.
>> Even if I use the _blank attribute, they all open up in different windows, which defeats the purpose
I understood Black Knight as NOT recommending target="_blank", but instead suggesting you use target="somewindowname" The target="_blank" attribute is a reserved name with it's own behavior.
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes");
}
// End -->
</SCRIPT>
</HEAD>
<BODY>
<a href="javascript:Start('http://www.webmasterworld.com')";>Webmaster World</a>
</BODY>
So ok, I have about 100 tutorial pages this script will be used on. This would mean using that code that goes in the head 100 times, which is not desirable. I believe its possible to link to a .js file externally??
I.E. I ask this because surely after a visitor has executed the script once, they will no longer have to receive the script from the server again and again. Can someone give me the pointers to do such a thing?
<head>
<title>New Page 1</title>
<script type="text/javascript" language="JavaScript" src="1.js"></script>
</head>
<body>
<a href="javascript:Start('http://www.yahoo.com')";>Yahoo</a><br>
<a href="javascript:Start('http://www.google.com')";>Google</a>
</body>
It returns with error on page. Any ideas?
i just copied and pasted it into notepad n it looks like this
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes");
}
// End -->
</SCRIPT>
After cleaning out the above, try this for your function definition:
function Start(page) {
window.open(page, "CtrlWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes");
}