PDA

View Full Version : Avoiding calling javascript by hand in every href



rqdavis
Mar 26th, 2008, 04:50 PM
I am very new to using javascript, but I have found a script to do what I want. I am using the javascript below to open links in the same new browser window that always stays on top. Can anyone tell me how I can avoid having to edit each individual href to in order to call the javascript? I am using Dreamweaver 2004. It seems I should be able to do this by using the "call javascript" behavior, but I don't know how to write the command.

Currently, I have my hrefs coded individually as follows:

<a href="javascript:newWindow('http://URL)">Link Name</a>

Thanks so much for your help!

Rachel



<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!--
<!--Hide script from old browsers
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'right=0,top=20,width=500,height=650,toolbar=yes,scrollbars=yes,resizable=yes')

winContent.focus()
}
//Stop hiding script from old browsers -->

function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
//-->
</SCRIPT>

abduraooft
Mar 26th, 2008, 04:58 PM
Look at this thread, http://www.codingforums.com/showthread.php?t=132274 , there he used such a javascript.

_Aerospace_Eng_
Mar 26th, 2008, 07:26 PM
You want all links to call that function?

rqdavis
Mar 26th, 2008, 07:41 PM
Yes, all the links on a particular page.

_Aerospace_Eng_
Mar 26th, 2008, 07:47 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'right=0,top=20,width=500,height=650,toolbar=yes,scrollbars=yes,resizable=yes')
winContent.focus()
}
window.onload = function()
{
var links = document.getElementsByTagName('a');
for(i = 0; i < links.length; i++)
{
links[i].onclick = function()
{
newWindow(this.href);
return false;
}
}
}
</script>
</head>
<body>
<a href="http://google.com">google</a>
<a href="http://google.com">google</a>
<a href="http://google.com">google</a>
<a href="http://google.com">google</a>
<a href="http://google.com">google</a>
</body>
</html>

rqdavis
Mar 26th, 2008, 08:25 PM
Thank you! That did the trick!

Rachel

rqdavis
Mar 26th, 2008, 10:03 PM
Of course, I was hasty in saying I wanted ALL links on the page to open in the same window--I didn't realize my breadcrumbs, and all my nav bar links would also open in this same window. Here's a link to the page I'm working on:

http://www.thomasmemoriallibrary.org/springthemes.shtml

My intent is for all links to our OPAC to open in the same window, which remains on top, so that users can place a hold on an item, then easily choose another item from my list and place another hold if desired.

Would putting the javascript in a .js file and calling it on a particular area of the page be a solution, or would it still apply to the whole page?

Thanks so much for your help!

Rachel

_Aerospace_Eng_
Mar 26th, 2008, 10:14 PM
Your page isn't loading for me. Just post all of your html for that page.

rqdavis
Mar 27th, 2008, 03:22 PM
Here's most of the html . I had to delete some from the bottom of the page because the text was too many characters to post. You might try this link to get to the page as well: http://www.cape.k12.me.us/tml/homepage/springthemes.shtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Spring Story Time Themes</title>
<meta name="Author" content="Thomas Memorial Library" />
<meta name="Description" content="The website of the Thomas Memorial Library, Cape Elizabeth, Maine" />
<meta name="Copyright" content="Copyright 2007, Thomas Memorial Library" />
<meta name="SVNInfo" content="$Id: template.html 2007 Rachel Q. Davis" />
<meta name="Language" content="en" />
<meta name="Generator" content="Hand-written XHTML using Emacs under Debian GNU/Linux" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />
<link rev="made" href="mailto:[email protected]" />
<link rel="StyleSheet" href="tml-screen.css" type="text/css" media="screen" />
<link rel="StyleSheet" href="tml-print.css" type="text/css" media="print" />
<link href="tml-screen.css" rel="stylesheet" type="text/css" />


<style type="text/css">
<!--
.month {background-color:#7594b0;
font:bold 12px arial;
color:white;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'right=0,top=20,width=500,height=650,toolbar=yes,scrollbars=yes,resizable=yes')
winContent.focus()
}
window.onload = function()
{
var links = document.getElementsByTagName('a');
for(i = 0; i < links.length; i++)
{
links[i].onclick = function()
{
newWindow(this.href);
return false;
}
}
}
</script>
</head>
<body><div id="container">

<!-- For non-visual or non-stylesheet-capable user agents -->
<div id="mainlink"><a href="#main">Skip to main content.</a></div>

<!-- ======== Header ======== -->
<div id="header">
<div><img src="Images/bannerFinal.jpg" alt="Thomas Memorial Library" width="779" height="195" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="3,4,201,189" href="widgery.shtml" alt="Photo of William Widgery Thomas,Jr."/>
<area shape="rect" coords="203,5,777,191" href="index.shtml" alt="Thomas Memorial Library"/>
</map>
</div>
<link rel="shortcut icon" href="/favicon.ico">
<div class="subheader">
<span class="hidden">Navigation:</span>
<a href="index.shtml">Home</a> |
<a href="about.shtml">About Us </a>|
<a href="faq.shtml">FAQ</a> |
<a href="contact.shtml">Contact Us </a> |
<a href="community.shtml">Community Links </a> </div>
</div>

<div id="wrap">
<!-- ======== Left Sidebar ======== -->
<div id="sidebar">
<ul class="glossymenu">
<li><a href="catalog.shtml" >Library Catalog</a></li>
<li><a href="account.shtml" >My Account/Renew Materials</a></li>
<li><a href="storytime.shtml" >Story Time Schedule</a></li>
<li><a href="newbooks.shtml">New Books, Movies &amp; More</a></li>
<li><a href="programs.shtml">Programs &amp; Events</a></li>
<li><a href="research.shtml">Research Databases &amp; Links</a></li>
<li><a href="awards.shtml">Awards, Bestsellers &amp; More</a></li>
<li><a href="adult.shtml">Adult Services</a></li>
<li><a href="youngadult.shtml">Young Adult Services</a></li>
<li><a href="children.shtml" >Children's Services</a></li>
</ul>
<div class= "divbox2">
<p class="hoursfont">Library Hours</p>
<p class="hourssmallfont">Monday: 9:00 - 5:00<br />
Tuesday: 9:00 - 8:30<br />
Wednesday: 9:00 - 5:00<br />
Thursday: 9:00 - 8:30<br />
Friday: 9:00 - 5:00<br />
Saturday: 9:00 - 5:00</p>
<p class="hoursSmallFont">(Saturday in summer:<br />
9:00 - 1:00)</p>
</div>
<div id="sidebarbox"><a href="http://www.tmlfdtn.org/"><img src="Images/tmlflogo.jpg" alt="Thomas Memorial Library Foundation logo" width="160" height="110" /></a>
</div>
</div>


<!-- ======== Main Content ======== -->
<div id="main">
<div id="navhead">
<hr />
<span class="hidden">Path to this page:</span>
<a href="index.shtml" class="crumbs">Home</a> &raquo;
<a href="programs.shtml" class="crumbs">Programs &amp; Events </a> &raquo;
<a href="storytime.shtml" class="crumbs">Story Time Schedule </a> &raquo; Spring Story Time Themes</div>
<h1>
<!-- ======== Footer ======== -->Spring Story Time Themes</h1>
<ul>
<li class="month"><a name="ducks" id="ducks"></a>&nbsp;&nbsp;Week of March 30 - April 5 </li>
<li class="floatbox"><strong>Five Little Ducks </strong>
<p>Five little ducks went in for a swim. <em>(Hold up hand, extend fingers.)</em><br />
<br />
The first little duck put his head in. <em>(Point to each finger in turn.)</em><br />
<br />
The second little duck put his head back.<br />
<br />
The third little duck said, &quot;Quack, quack, quack.&quot;<br />
<br />
The fourth little duck with his tiny brother<br />
<br />
Went for a walk with his father and mother.<em> (&quot;Walk&quot; fingers up opposite arm.) </em></p>
<p></p>
</li>
<br />
<li class="boldfontblue"> Just Ducky!</li>
<li> Welcome spring with stories and songs about lovable ducks and ducklings. </li>
<li>
<h4>Recommended books:</h4>
</li>
<li><a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=Cold+Little+Duck,+Duck,+Duck&amp;searchscope=71">Cold Little Duck, Duck, Duck</a>, by Lisa Westberg Peters<br />
<a href="http://minerva.maine.edu/search/?searchtyphttp://minerva.maine.edu/search/?searchtype=t&searcharg=come+along+daisy&searchscope=38">Come Along Daisy</a>, by Jane Simmons<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=dawdle+duckling&searchscope=38">Dawdle Duckling</a>, by Toni Buzzeo<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duck+at+the+door&searchscope=71">Duck at the Door</a>, by Jackie Urbanovic<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duck+on+a+bike&searchscope=38">Duck on a Bike</a>, by David Shannon<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duckat&searchscope=38">Duckat</a>, by Gaelyn Gordon<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duckie%27s+rainbow&searchscope=38">Duckie's Rainbow</a>, by Frances Barry<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=fluffy+and+baron&amp;searchscope=38">Fluffy and Baron</a>, by Laura Rankin<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=guji+guji&amp;searchscope=38">Guji Guji</a>, by Chi-Yuan Chen<br />
<a href="http://minerva.maine.edu/search/tlittle+quack/tlittle+quack/1,3,3,B/frameset&amp;FF=tlittle+quack&amp;1,1,/indexsort=-">Little Quack</a>, by Lauren Thompson<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=one+duck+stuck&amp;searchscope=38">One Duck Stuck</a>, by Phyllis Root<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=ten+little+rubber+ducks&amp;searchscope=38">Ten Little Rubber Ducks</a>, by Eric Carle<br />
</li>
</ul>
<p>&nbsp;</p>
<ul>
<li class="month"><a name="spring" id="spring"></a>&nbsp;Week of April 6 - 12 </li>
<li class="floatbox"><strong>During the Spring</strong><br />
<p>During the Spring, it often showers <br />
<em>(flutter fingers down)</em></p>
<p>Or the sun shines for many hours<br />
<em>(form circle in the air with arms)</em></p>
<p>Both are good for the flowers!<br />
<em>(cup each hand and extend arms like flowers)<br />
<br />
</em><br />
</p>
</li>
<li class="boldfontblue"> Think Spring! </li>
<li>Celebrate springtime in Maine with storis about spring blooms, baby animals, melting ice, and, of course, mud! </li>
<li>
<h4>Recommended books:</h4>
</li>
<li><a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=bear+wants+more&amp;searchscope=38">Bear Wants More</a>, by Karma Wilson<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=Cold+Little+Duck,+Duck,+Duck&amp;searchscope=71">Cold Little Duck, Duck, Duck</a>, by Lisa Westberg Peters<br />
<a href="http://minerva.maine.edu/search/tit%27s+spring/tits+spring/1%2C1%2C2%2CB/frameset&amp;FF=tits+spring&amp;2%2C%2C2/indexsort=-">It's Spring!</a>, by Linda Glaser<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=mouse%27s+first+spring&amp;searchscope=38">Mouse's First Spring</a>, by Lauren Thompson<br />
<a href="http://minerva.maine.edu/search/tMud/tmud/1%2C10%2C10%2CB/frameset&amp;FF=tmud&amp;1%2C1%2C/indexsort=-" target="_blank">Mud</a>, by Mary Lyn Ray<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=my+spring+robin&amp;searchscope=38" target="_blank">My Spring Robin</a>, by Anne Rockwell<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=possum+and+the+peeper&amp;searchscope=38" target="_blank">Possum and the Peeper</a>, by Anne Hunter<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=rabbit%27s+good+news&amp;searchscope=38" target="_blank">Rabbit's Good News</a>, by Ruth Lercher Bornstein<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=skunk%27s+spring+surprise&amp;searchscope=38" target="_blank">Skunk's Spring Surprise</a>, by Leslea Newman<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=splish+splash+spring&amp;searchscope=38" target="_blank">Splish, Splash, Spring</a>, by Jan Carr<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=spring+things&amp;searchscope=71" target="_blank">Spring Things</a>, by Bob Raczka<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=wake+up+it%27s+spring&amp;searchscope=38" target="_blank">Wake Up, It's Spring</a>, by Lisa Campbell Ernst<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=when+will+it+be+spring&amp;searchscope=38" target="_blank">When Will It Be Spring?</a>, by Catharine Walters<br />
</li>
</ul>
<p>&nbsp;</p>
<ul>
<li class="month">&nbsp;<a name="rabbits" id="rabbits"></a>Week of April 13 - 19 </li>
<li class="floatbox"><strong>Hippity-Hop</strong><br />
<p>Hippity-hop, hippity-hay,<br />
Five little bunnies went out to play.<br />
Hippity hippety-hop hay hay, <br />
One little bunny hopped away. <br />
Hippity-hop, hippity-hay,<br />
Four little bunnies went out to play.</p>
<p><em>(Continue rhyme until all bunnies hop away.)<br />
<br />
</em>Hippity-hop, hippity-hay,<br />
No little bunnies are out to play<br />
Because they have all hopped away!<br />
Hippity hippety-hop hay hay! <br />
</p>
</li>
<li class="boldfontblue"> Hippity-Hop</li>
<li>It's time for stories about fuzzy, hoppity, bouncy, bunnies! </li>
<li>
<h4>Recommended books:</h4>
</li>
<li><a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=The+Bunnies+Are+Not+in+Their+Beds&amp;searchscope=38" target="_blank">The Bunnies Are Not in Their Beds</a>, by Marisabina Russo<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=Bunny%27s+Noisy+Book&amp;searchscope=38" target="_blank">Bunny's Noisy Book</a>, by Margaret Wise Brown<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=dinnertime&amp;searchscope=38" target="_blank">Dinnertime!,</a> by Sue Williams<br />
<a href="http://minerva.maine.edu/search/tThe+Magic+Rabbit/tmagic+rabbit/1,1,2,B/frameset&amp;FF=tmagic+rabbit&amp;1,,2/indexsort=-" target="_blank">The Magic Rabbit</a>, by Richard Jesse Watson<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=muncha&amp;searchscope=38" target="_blank">Muncha Muncha Muncha!</a>, by Candace Fleming<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=my+friend+rabbit&amp;searchscope=38" target="_blank">My Friend Rabbit</a>, by Eric Rohmann<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=rabbit+pie&amp;searchscope=38" target="_blank">Rabbit Pie</a>, by Penny Ives<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=rabbits+and+raindrops&amp;searchscope=38" target="_blank">Rabbits and Raindrops</a>, by Jim Arnosky<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=rabbit%27s+gift&amp;searchscope=38" target="_blank">Rabbit's Gift,</a> by George Shannon<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=rabbit%27s+good+news&amp;searchscope=38" target="_blank">Rabbit's Good News</a>, by Ruth Lercher Bornstein<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=tippy+tippy+tippy&amp;searchscope=38" target="_blank">Tippy Tippy Tippy Hide!,</a> by Candace Fleming<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=tippy+tippy+tippy&amp;searchscope=38" target="_blank">Too Many Bunnies</a>, by Matt Novak<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=what+does+bunny+see&amp;searchscope=38" target="_blank">What Does Bunny See?</a>, by Linda Sue Park<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=Will+You+Be+My+Friend%3F&amp;searchscope=38" target="_blank">Will You Be My Friend?</a>, by Nancy Tafuri </li>
<p>&nbsp;</p>
<li class="month">&nbsp;<a name="frogs" id="frogs"></a>Week of April 20 - 26 </li>
<li class="floatbox"><strong>Five Green &amp; Speckled Frogs</strong><br />
<p><em>(count down on your fingers as indicated) </em></p>
<p>Five green and speckled frogs, <br />
Sat on a speckled log,<br />
Eating the most delicious bugs- yum-yum! <em>(rub tummy)</em></p>
<p>One jumped into the pool,<br />
Where it was nice and cool,<br />
Now there are four green speckled frogs.<br />
Glub! Glub!</p>
<p><em>(repeat until there are no frogs left)</em><br />
</p>
</li>
<li class="boldfontblue"> Ribbit! Ribbit! </li>
<li> This week we'll hear stories about spring peepers and their froggy cousins.</li>
<li>
<h4>Recommended Books:</h4>
</li>
<li><a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=bee+frog&amp;searchscope=71" target="_blank1">Bee Frog</a>, by Martin Waddell<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=hop+jump&amp;searchscope=38" target="_blank1">Hop Jump</a>, by Ellen Stoll Walsh<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=In+the+Middle+of+the+Puddle&amp;searchscope=38" target="_blank1">In the Middle of the Puddle</a>, by Mark Thaler<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=It%27s+Mine%21&amp;searchscope=38">It's Mine!</a>, by Leo Lionni<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=Jump%2C+Frog%2C+Jump%21&amp;searchscope=38">Jump, Frog, Jump!</a>, by Roger Kalan<br />
Little Quack's New Friend, by Lauren Thompson<br />
Marsh Music, by Marianne Collins Berkes<br />
One Frog Sang, by Shirley Parenteau<br />
Peeping and Sleeping, by Fran Manushkin<br />
Possum and the Peeper, by Anne Hunter<br />
Stick, by Steve Breen<br />
Too Many Frogs, by Sandy Asher<br />
<p>&nbsp;</p>
</li>
<li class="month"><a name="rain" id="rain"></a>&nbsp;Week of April 27 - May 3 </li>
<li class="floatbox"><strong>Big Round Sun</strong><br />
<p>The big round sun in the springtime sky <em>(form large circle with arms)</em></p>
<p>Winked at a cloud that was passing by. <em>(wink eye)</em></p>
<p>The little cloud laughed as it scattered rain,<em> (flutter fingers downward)</em></p>
<p>Then out came the big round sun again. <em>(form large circle with arms)</em></p>
<p></p>
</li>
<li class="boldfontblue">Singin' in the Rain </li>
<li>This week we'll hear stories and sing songs about the animals, plants, and people who love a rainy day. </li>
<li>
<h4>Recommended Books:</h4>
</li>
<li>Duckie's Rainbow, by Frances Barry<br />
In the Middle of the Puddle, by Mike Thaler<br />
In the Rain with Baby Duck, by Amy Hest<br />
Little Cloud, by Eric Carle<br />
One Rainy Day, by Valeri Gorbachev<br />
Rabbits and Raindrops, by Jim Arnosky<br />
Raindrop Plop, by Wendy Cheyette Lewison<br />
Red Rubber Boot Day, by Mary Lyn Ray<br />
The Puddle, by David McPhail<br />
The Rain Came Down, by David Shannon<br />
The Water Hole, by Graeme Base<br />
Who Likes Rain?, by Herbert Wong Lee<br />
</li>
<p>&nbsp;</p>

</div>
</body>
</html>

abduraooft
Mar 27th, 2008, 03:26 PM
My intent is for all links to our OPAC to open in the same window, OPAC ?

PS:Please use [CODE] (using http://www.codingforums.com/images/editor/code.gif) while posting your code here.

rqdavis
Mar 27th, 2008, 04:08 PM
Sorry--I forgot I wasn't talking to other librarians. OPAC stands for Online Public Access Catalog, meaning a library's online "card" catalog.

Rachel

_Aerospace_Eng_
Mar 27th, 2008, 04:22 PM
Okay so then WHAT links did you want to have open in a popup? We can't read your mind. WHERE in the HTML are those links?

abduraooft
Mar 27th, 2008, 04:24 PM
Hiya, if you are trying to achieve this property for a set of links comes under a particular parent element, say
sidebar(<div id="sidebar">), Aero's above code could be modified as


var links = document.getElementById('sidebar').document.getElementsByTagName('a');
...................
Or if you want to give this effect for a single link, give a unique id for it and simply use a script like,


var link = document.getElementById('link1');
link.onclick = function()
{
newWindow(this.href);
return false;
}



<a href="http://google.com" id="link1">google</a>

rqdavis
Mar 27th, 2008, 04:36 PM
Sorry again--I'm learning all this as I go. The links that I want to appear in the new browser window are those go to the catalog record for the recommended books, such as:

<li><a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=Cold+Little+Duck,+Duck,+Duck&amp;searchscope=71">Cold Little Duck, Duck, Duck</a>, by Lisa Westberg Peters<br />
<a href="http://minerva.maine.edu/search/?searchtyphttp://minerva.maine.edu/search/?searchtype=t&searcharg=come+along+daisy&searchscope=38">Come Along Daisy</a>, by Jane Simmons<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=dawdle+duckling&searchscope=38">Dawdle Duckling</a>, by Toni Buzzeo<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duck+at+the+door&searchscope=71">Duck at the Door</a>, by Jackie Urbanovic<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duck+on+a+bike&searchscope=38">Duck on a Bike</a>, by David Shannon<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duckat&searchscope=38">Duckat</a>, by Gaelyn Gordon<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&searcharg=duckie%27s+rainbow&searchscope=38">Duckie's Rainbow</a>, by Frances Barry<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=fluffy+and+baron&amp;searchscope=38">Fluffy and Baron</a>, by Laura Rankin<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=guji+guji&amp;searchscope=38">Guji Guji</a>, by Chi-Yuan Chen<br />
<a href="http://minerva.maine.edu/search/tlittle+quack/tlittle+quack/1,3,3,B/frameset&amp;FF=tlittle+quack&amp;1,1,/indexsort=-">Little Quack</a>, by Lauren Thompson<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=one+duck+stuck&amp;searchscope=38">One Duck Stuck</a>, by Phyllis Root<br />
<a href="http://minerva.maine.edu/search/?searchtype=t&amp;searcharg=ten+little+rubber+ducks&amp;searchscope=38">Ten Little Rubber Ducks</a>, by Eric Carle<br />
</li>


Sorry if this is not the proper way to post HTML.

Rachel

_Aerospace_Eng_
Mar 27th, 2008, 04:41 PM
Okay the easiest thing to do would be to give an id to the ul element that begins the recommendations and then use the code that I gave you with the first change that abdura suggested.

abduraooft
Mar 27th, 2008, 04:44 PM
Then give an id to the ul,

<ul>
<li class="month"><a id="ducks" name="ducks"/> Week of March 30 - April 5 </li>
<li class="floatbox"><strong>Five Little Ducks </strong>
<p>Five little ducks went in for a swim. <em>(Hold up hand, extend fingers.)</em><br/>
<br/>
The first little duck put his head in. <em>(Point to each finger in turn.)</em><br/>
................
like <ul id="external"> and then change your javascript as

var links = document.getElementById('external').document.getElementsByTagName('a');
for(i = 0; i < links.length; i++)
{
links[i].onclick = function()
{
newWindow(this.href);
return false;
}
}

rqdavis
Mar 28th, 2008, 03:16 PM
Like I said, I'm learning as I go. If I give an ID to the ul, such as "external," am I creating a new CSS tag called "external?" If so, what definitions do I give to "external?"

Thanks so much for all your help (and patience!)

Rachel

abduraooft
Mar 28th, 2008, 03:44 PM
No need to define a rule in CSS for every elements in html. Just proceed with your javascript and don't worry about CSS in this case. (Make sure that you don't have any other element having id="external", which is not allowed.)

rqdavis
Mar 28th, 2008, 04:07 PM
Thanks again. I tried it out, but am still getting ALL links opening in the new window, not just the ones in the ul. Any idea what I'm doing wrong?

http://www.thomasmemoriallibrary.org/springthemes.shtml

abduraooft
Mar 28th, 2008, 04:35 PM
but am still getting ALL links opening in the new window,
Huh? I get all the links in the same window!
Have you given that id="external" or something like ? Have you made any changes to your javascript ?

_Aerospace_Eng_
Mar 28th, 2008, 04:35 PM
Now your HTML is invalid. Why did you try creating a new unordered list? Just add id="booklist" to the main ul since the only links in that are recommended books unless that data will change.

rqdavis
Mar 28th, 2008, 04:50 PM
I had created an new ul because it didn't work the way you suggested. I have now deleted the new ul, and changed the it to ul id="booklist", but I am still getting all links (even my sidebar and nav bar links) opening in the new window.

rqdavis
Mar 28th, 2008, 06:12 PM
I just checked my page in Firefox and see that everything is opening in the parent window, but in IE 7, every link opens in the new browser window on top.

I may just give up and go back to formatting each href individually at this point (unless anyone has a cross-browser solution!)

Thanks for all your help (and tolerance.)

Rachel

rqdavis
Mar 28th, 2008, 10:15 PM
For some reason, www.thomasmemoriallibrary.org is not working at the moment. My page can be seen at:
http://www.cape.k12.me.us/tml/homepage/springthemes.shtml

_Aerospace_Eng_
Mar 29th, 2008, 05:53 PM
Your code was still wrong. And the problem wasn't the code, it was the browser. Browsers are setup differently to treat popups differently. Like IE may open a popup in a tab instead. Firefox may open it up normal. Now you just went and wasted your time putting each function call in there, incorrectly I might add because if JS is disabled the user won't see your links.