none
Behaviors RRS feed

  • Question

  • I am writing text in a paragraph tag. There are three letters that I want to create a hyperlink for, EPA (Environmental Protection Agency).  I want the hyperlink to open a new browser window when the viewer clicks on "EPA."  I was having difficulty with this.  I acutally had it working but for certain reasons lost it, and I cannot recreate it.  The procedure that I am using is to create a span just for the letters EPA.  Then in that span I select the letters "EPA" and create the hyperlink to the appropriate page on EPA's web site.  After that I want to set the Behavior for that hyperlink.  The problem that I am having is that when I go inside the span in Code view, and select or mouse over each piece of Code, I cannot get the "onclick" event to come up in Behavior. Without the "onclick" event showing up in the Behaviors window I cannot use the "Open Browser Window."  How do I get the "onclick" Event to show up? What am I doing wrong?

    Thanks to anyone who responds!

    Wednesday, August 10, 2011 4:57 PM

Answers

  • Don't use <span> and apply a behavior, that is really bad practice and completely unnecessary. BTW what you are doing would drive me nuts as an end user. I want to know where the link is going and if EPA leads to different links on their site I'd never realize it.

    Accessiblity requires that each link has unique text that provides info on where it goes so you should have more than one word linked even using title attribute alone is insufficient since many assisitive devices don't read the title attribute. You should also not open new windows unless you notify the person that it will open in a new link since if the link opens in a background window the person may not realized it opened or alternatively if if takes focus they won't realize that it is a new window and the back button won't "restore" their previous view.

    <a href=http://epa.gov/whaterver title="linked info" target="_blank">EPA</a>


    Free Expression Web Tutorials
    For an Expression Web forum with without the posting issues try expressionwebforum.com
    • Marked as answer by KDW12 Wednesday, August 10, 2011 9:02 PM
    Wednesday, August 10, 2011 5:53 PM

All replies

  • "What am I doing wrong?"
    Using Behaviours instead of simple HTML.

    <a href="http://epawebsite.com/epaPage.htm" target="_blank">EPA</a>
    will work, provided the !doctype is not Strict.

    A browser window opened with javascript (behaviours are javascript) may be blocked by the user's browser configuration.


    Ron Symonds
    Microsoft MVP (Expression Web)

    www.rxs-enterprises.org/fp
    Wednesday, August 10, 2011 5:12 PM
  • Don't use <span> and apply a behavior, that is really bad practice and completely unnecessary. BTW what you are doing would drive me nuts as an end user. I want to know where the link is going and if EPA leads to different links on their site I'd never realize it.

    Accessiblity requires that each link has unique text that provides info on where it goes so you should have more than one word linked even using title attribute alone is insufficient since many assisitive devices don't read the title attribute. You should also not open new windows unless you notify the person that it will open in a new link since if the link opens in a background window the person may not realized it opened or alternatively if if takes focus they won't realize that it is a new window and the back button won't "restore" their previous view.

    <a href=http://epa.gov/whaterver title="linked info" target="_blank">EPA</a>


    Free Expression Web Tutorials
    For an Expression Web forum with without the posting issues try expressionwebforum.com
    • Marked as answer by KDW12 Wednesday, August 10, 2011 9:02 PM
    Wednesday, August 10, 2011 5:53 PM
  • Thank you for your reply Cheryl, I appreciate the info.  Here's some more input on this issue, which you might be interested in.  Regarding "span", I did that in conformance with Jim Cheshire's recommendation in his book "Microsoft Expression Web 4 In Depth" page 344, see section "Adding Behaviors Within a Paragraph."  I take note of your commnet regarding informing the viewer that clicking on the link will open another window.  I agree that is necessary, although the target audience of my web page (engineering related) will know what to expect.  BTW, I am a newbie at writing Web sites.  I just got Expression Web 4 and read most of "Microsoft Expression Web 4 Step by Step" by Chris Leeds. This book helped me get underway in writing my own web site (I haven't made it live yet).  I bought Cheshire's book to use as a reference.  I played around with the letters "EPA" and added a button.  Once I added the button it gave me the "clickon" Event that I needed to add the Behavior of opening a new window.  It does what I want now.  I will add text (small print) beside the button that states "clicking on this button will open a separate page" or something to that effect.  It is now working as I imagined.  Thanks for the input and if you have any more adivce I'm all ears since I am new at this and will listen to input from those experienced in writing web pages. 

    Thanks again!

    Kurt

    Wednesday, August 10, 2011 6:10 PM
  • Jim tells you how  to do things using Expression Web it is a "how to" book and as such provides little guidance on why you should or should not do something, only how to do it. I don't know anyone who uses those behaviors other than those who originally created the site using FrontPage - backwards compatiblity and as such haven't been updated for a decade. There are far better methods for doing each and every thing the behaviors do.

    What I talked about is universal design/accessiblity/usability which is a completely different field and one that if you are referencing the EPA is something you should be concerned about.

    As for more advice, start with the resources in the FAQ post at the top of this forum. I'd also recommend concentrating more on web standards than how to use Expression Web.


    Free Expression Web Tutorials
    For an Expression Web forum with without the posting issues try expressionwebforum.com
    Wednesday, August 10, 2011 6:30 PM
  • I agree that is necessary, although the target audience of my web page (engineering related) will know what to expect.

    Wrong attitude, and a bad habit to get into since you state that your wish is to learn good development practices. When it comes to usability, don't make assumptions about your visitors' expectations. Plan for the worst-case presumption: That the user does not know that clicking the link opens a new window. You might want to spend some quality time with Steve Krug's "Don't Make Me Think" guide to usability.

    It does what I want now.

    Ah, the "it'll get by" syndrome. Never mind that scripting is unnecessary for this application, or that users with scripting limited or disabled are out of luck, or the obtrusiveness of that antiquated Behaviors scripting itself. I've got it working this way now. Best practices? Meh...

    Bad habits are much more easily corrected before they become habits. Just sayin'...   ;-)

    cheers,
    scott


    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.
    Wednesday, August 10, 2011 8:15 PM
  • Exactly. In fact, my example here is not a good one and if I do a revision on the book, I will remove that. When I'm writing, I try to address questions that I get in email from people, but in some cases like this one, I should rethink the example. This would have actually been a good opportunity to explain the "when you should and when you shouldn't" aspect of Behaviors.

     


    Jim Cheshire -- Microsoft
    Wednesday, August 10, 2011 8:24 PM
    Moderator
  • Jim,

    I'm sure that will be very helpful. As a "how to" book I recommend yours highly but many folks also need the when & why/not assistance as well.


    Free Expression Web Tutorials
    For an Expression Web forum with without the posting issues try expressionwebforum.com
    Wednesday, August 10, 2011 10:58 PM