SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Should I use <a> or <href> control??

    Hello my Good folks,

    As you folks, I am still newbie to web development.

    I have a requirement where when the user clicks on a <HyperLink> control or a simple <a> element, the popup window has to come up.

    When I code like the below with <a> element, I expected "Show Current" text should look like a hyperlink (with underline). But it doesn't.
    It looks like a plain text. Even though it looks like a plain text, when the user clicks on that text (Show Current), popup window pops up.
    I really want the "Show Current" to look like a hyperlink.

    How can I do this?

    Code:
    <a font=bold onclick="OpenWindow_HistoricalRuns();">Show Current</a>
    Thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was able to get around it.

    Code:
     <a font=bold onclick="OpenWindow_HistoricalRuns();" 
               style="font-size: medium; font-weight: bold; text-decoration: underline">Show Current</a>
    But is this the right way of launching Popups? should I be using <Hyperlink> server control to do this?

  3. #3
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    There is no attribute "font" on anchor, lacking a href means you have no scripting off graceful degredation since that should be a link to handle it as if there were no scripting IN ADDITION to your onclick... and really one probably shouldn't be inlining style in the markup.

    Much less there's no suck thing as <hyperlink>, and href is an attribute, not a tag so it doesn't belong in brackets.

    Code:
    <a 
    	href="urlForScriptingOffUsers.html"
    	onclick="OpenWindow_HistoricalRuns();"
    	class="showCurrent"
    >Show Current</a>
    With all that CSS set on .showCurrent; though depending on where/how you're using that anchor, it might not need the class.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •