Welcome to WebmasterWorld Guest from 54.167.86.211

Forum Moderators: open

Message Too Old, No Replies

Define terms via IE behaviors (.htc)

a genuine use for encapsulated javascript

     
9:16 pm on Jul 29, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Nov 6, 2001
posts:275
votes: 0


I'm looking to mark certain technical terms I use on my site with a specific class via css (e.g. <span class="definedterm">Thingamajig</span>), so that I could attach a behavoir file (.htc) to them that would link to the relevant entry on a glossary page (e.g. /glossary.html#thingamajig).

External behavoirs seem like the ideal solution for this since they wouldn't dilute the relevant links on the page with a bunch of links googlebot would see.

Anyone know of a script that could be easily adapted to this purpose?

7:30 pm on July 30, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


It looks like you're ahead of the curve here. I've asked around for help, but no one's stepping forward. I'm guessing that most of us haven't ventured in this direction because it's an IE only solution,

There's info on Microsoft's developer site and others, but no ready made scripts.

For anyone who wants to learn a bit, this page [msdn.microsoft.com] offers a pretty good overview.

9:06 am on July 31, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 25, 2002
posts:3185
votes: 0


More from the MSDN site on behaviours here:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/behaviors/overview.asp [msdn.microsoft.com].

I'll second Tedsters sentiments, since these are IE only I can't go near them - it would cut out a percentage of users and that would be unacceptable to my clients.

1:22 pm on July 31, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 0


I'm one of the lucky ones, I develop intranet solutions almost solely for IE so I've had some great *fun* with behaviours. This should get you started:

Your glossary.htc file:

<PUBLIC:COMPONENT id="bhvGlossary"> 
<PUBLIC:ATTACH event="onclick" handler="goClick" />

<script type="text/javascript">
function goClick()
{
//change this to document.location.href = ... etc.
alert("glossary.asp#" + this.innerText );
}
</script>
</PUBLIC:COMPONENT>

Your HTML file:

<html> 
<head>
<title>My First Behaviour</title>
<style>
.toGlossary
{
behavior:url(glossary.htc)
}
</style>
</head>

<body>
<span class="toGlossary">a glossary word</span>
</body>
</html>

I'm sure you'll get the idea and be able to manipulate the above to make it work for you. Be warned I have run into some odd behavior with behaviors (like form elements not resetting), though they were really quite complex behaviours. A simple script like the above will be fine.

J

[edited by: joshie76 at 1:34 pm (utc) on July 31, 2002]

1:33 pm on July 31, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 10, 2001
posts:793
votes: 0


PS...

<span onclick="goClick()">a glossary word</span>


Would probably be just as effective and cross-browser (except NN4 for the majors).
1:48 pm on July 31, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Nov 6, 2001
posts:275
votes: 0


Thanks a mil joshie! That's *exactly* what I was looking for. It'll be a cinch for me to adapt that to my needs.

Next step:
Google Web API's + Microsoft SOAP Behavior :-)

[google.com...]
[msdn.microsoft.com...]

Too bad this never caught on:
[w3.org...]

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members