# Really annoying coding question

**URL:** <https://boards.straightdope.com/t/really-annoying-coding-question/37917>\
**Category:** Factual Questions\
**Created:** [October 23, 2000, 12:16am UTC](https://boards.straightdope.com/t/really-annoying-coding-question/37917 "2000-10-23T00:16:01Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![JamesCarroll](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@JamesCarroll](https://boards.straightdope.com/u/JamesCarroll)\
**Post date:** [October 24, 2000, 4:19am UTC](https://boards.straightdope.com/t/really-annoying-coding-question/37917/21 "2000-10-24T04:19:53Z")

</div>

Ok, here’s the fancy dancy one. It (of course requires two files):

**Maindoc.htm**

```auto

<HTML>
<HEAD>
<TITLE> Main Document </TITLE>
  <SCRIPT language ="javascript" runat = "client">
    function showWindow(strWord){
      var file = "child.htm#" + strWord;
      window.open(file,null,'height = 50,
      width =200,top = 200,left = 300, scrollbars =1'
      ,true);
    }

  </script>	
</head>

<BODY>
Some people like
<A onclick = showWindow(this.innerText)
style = "color:blue;text-decoration: underline"> apple</a>s ,
but I prefer <A onclick = showWindow(this.innerText)
style = "color:blue;text-decoration: underline">banana</A>s.
</body>
</html>

```

**Defs.htm**

```auto

<HTML>
<HEAD>
  <TITLE>Definitions </TITLE>
  <STYLE type="text/css">
  <!--
  A {
     font-size: 15 px;
     font-weight: bold;
     font-family:Arial, sans-serif;
     color: blue;
    }
  h2{
     font-size: 10 px;
     font-family:Arial, sans-serif;
     color:#000000;
     text-indent: 20 px;
    }
  -->
  </STYLE>

</HEAD>
<BODY bgcolor =	#ffffcc onclick = "close();">
<A name	= Apple>Apple</A>
<H2>The apple is a tasty fruit</H2>

<A name	= Banana>Banana</A>
<H2>Time flies like the wind, fruit flies like
bananas	</H2>

</BODY>
</HTML>

```

The basic premise is that in the main doc words that you want to define are wrapped with \<A\> tags that define their style and call the showWindow funcition passing the text that is contained. The contained text cooresponds to an anchor in the definition file. As the new window is being open we change its size and position, load the page, and then move to the definition.

Let me know if you need more help.

---

<div class="post-metadata">

**Author:** ![iampunha](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@iampunha](https://boards.straightdope.com/u/iampunha)\
**Post date:** [October 24, 2000, 6:29am UTC](https://boards.straightdope.com/t/really-annoying-coding-question/37917/22 "2000-10-24T06:29:22Z")

</div>

Okay . . . I think I got it. I fuddled around with some code I got from **cessandra** and basically did a bit of javacode beforehand, put it in, then referred the html back to it. I’ll worry about placement when I get the paper written . . .

Thanks to all who helped. I will doubtless be back later on this week for more help:)

[Previous page](https://boards.straightdope.com/t/really-annoying-coding-question/37917.md?page=1)
