[thelist] Re: the onclick and reg exp thing

Diane Soini dianesoini at earthlink.net
Sat Aug 23 19:25:57 CDT 2003


I actually did a search the other day (in homesite) for anchor tags 
using onclick for popup windows. It wasn't a huge job, but this is how 
I did it. First of all, I never trust that using a tool's find and 
replace or reg exp search will work 100% because I don't always write 
things 100%.

First I did a search for just "<a href="javascript:". I poked around in 
the results to see how they looked. Pretty good. I noticed that there 
were times I used javascript: void window.open and other times that I 
used a little openWindow function instead, plus there was a function 
for openThis, and openThat. Oh well. At least I keep all those in an 
external javascript file.

Next I did a search for "<a href="javascript:void". Opened all the 
results and manually - yes - changed the links. The thing I've learned 
is that automatic doesn't let me see where I screwed up. Then I did the 
search for my custom functions.

For some of my custom openThis or openThat functions I could use the 
find and replace tool because they were all opening the same file, so I 
did that on directory-by-directory basis so I wouldn't get totally lost 
in any mistakes. I checked each result as I did it too, just in case.

As I went a long, when I noticed that some things could be safely 
automated in a find and replace, I did it. Otherwise, I stuck to 
manual. Generating the initial list of files saved the majority of my 
time, and gave me a starting place, so it wasn't so bad.


On Saturday, August 23, 2003, at 04:04 AM, 
thelist-request at lists.evolt.org wrote:

>> Thanks Gary,
>>
>> once I made sure I ticked Regular expressions on !! :-)
>> this worked, but it replaced the URL with $1  !!
>>
>> I was using Homesite 4.5. (actually CF Studio 4.5)
>> Will try with CF5 and various Dreamweaver versions at home,
>>
>> BTW also, what was the /s for after the first href?
>> href="#"\sonClick I had to remove this to get it to work.
>
> Seems Dreamweaver and Homesite handle this differently as I tested in
> Dreamweaver MX before posting my reply and it worked as intended. the 
> \s
> represents the space between the href and onclick attributes. Some
> suggestions have been posted for use in Homesite, perhaps they'll be of
> use to you, otherwise give it a whirl in Dreamweaver and see how that
> pans out for you.
>
> All the best,
>
> Gary



More information about the thelist mailing list