Click to See Complete Forum and Search --> : Dreamweaver CS3 Find and Replace


coded-red
09-04-2008, 10:21 AM
Hi Everyone!

I am trying to go through an entire site and check the links to make sure they all open in a new page. I was using Find and Replace and searching for A Href that don't have a target tag associated but it's returning a bunch of other links I don't want to change (javascript, anchors). Is there a way I can exlude any links that have specific text in the link?

Thanks in advance,
Jon
:eek:

said_fox
09-05-2008, 02:45 PM
Hi,

Why you don't use Jquery (http://jquery.com) to make all of your links to be targeted in _blank page?

coded-red
09-05-2008, 10:18 PM
Never heard of it :) I'm no pro at this stuff, just have a basic understanding and am trying to come up with some alternatives for an internal company site.

I'll check it out, thanks Said!

said_fox
09-06-2008, 08:46 PM
Also you may able to set base tag inside the head tag of each of your pages as follows:

<html>
<head>
<title>CodeAve.com(Base Target)</title>
<base target="_blank">
</head>

To read more about this tag check this article (http://www.codeave.com/html/code.asp?u_log=5029) or this article (http://www.w3schools.com/TAGS/tag_base.asp) on w3schools.com

coded-red
09-10-2008, 12:18 PM
Also you may able to set base tag inside the head tag of each of your pages as follows:

<html>
<head>
<title>CodeAve.com(Base Target)</title>
<base target="_blank">
</head>

To read more about this tag check this article (http://www.codeave.com/html/code.asp?u_log=5029) or this article (http://www.w3schools.com/TAGS/tag_base.asp) on w3schools.com

Jquery looks like it has a lot of advantages but I don't think we will be using it. I could get more familiar with it and use it but i'm not the only one our team that works with this content.

So, that being said, the base target option sounds like a great idea. The only problem I see is that the base target doesn't apply to links that already have a target set, only to links that do not have a target. We have many pages that already have targets set to _self that need to be changed. Any other thoughts?

said_fox
09-10-2008, 07:32 PM
You have to use the following javascript code on every page.

<script>
function blankIt(){
p = document.getElementsByTagName('a')

for (i = 0; i < p.length; i++){
if (p[i].target != null){
if (p[i].target != '_blank') p[i].target = '_blank';
}
}
}
</script>


Then call blankIt function at the end of your page before </body>

coded-red
09-11-2008, 10:21 AM
You have to use the following javascript code on every page.

<script>
function blankIt(){
p = document.getElementsByTagName('a')

for (i = 0; i < p.length; i++){
if (p[i].target != null){
if (p[i].target != '_blank') p[i].target = '_blank';
}
}
}
</script>


Then call blankIt function at the end of your page before </body>

Thank you for taking the time to answer all of my noob questions Said. I'm not too familiar with calling Javascript functions. The only way I know how is to add a click function, is there a way to call the function without changing all the links?

said_fox
09-11-2008, 12:04 PM
Yes it is very easy.

Before </body> you have the following code:

<script>
blankIt();
</script>


But don't forget to add the code regarded in my previous reply in the head section of your page. i.e before </head>

coded-red
09-11-2008, 03:33 PM
Yes it is very easy.

Before </body> you have the following code:

<script>
blankIt();
</script>


But don't forget to add the code regarded in my previous reply in the head section of your page. i.e before </head>

You are my new favorite person! Thank you so much for your time

said_fox
09-11-2008, 05:37 PM
Never mind! you are welcomed and good luck. :)