onClick Calender issue not loading, Error msg: Bad Request (Invalid Hostname)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • divina11
    New Member
    • Aug 2007
    • 55

    onClick Calender issue not loading, Error msg: Bad Request (Invalid Hostname)

    Can someone explain what the following line does or mean:
    [CODE=javasript]"javascript:voi d(0)"[/CODE]

    The rest of my Calender pop-up code:

    [CODE=javascript]<span onclick='select Date("startdate ")'><a href="javascrip t:void(0)"><img valign="middle" src="http://ai.spirahellic. com/DDL/media/calender_icon.g if" alt="" width="19" height="20" border="0"></a></span>[/CODE]

    Thank you
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    The javascript code "javascript:voi d(0)" means do nothing.

    [code=html]
    <a href="javascrip t:void(0);" onclick="functi on();">Link</a>
    [/code]

    in the example above a link is created and when it is clicked you would rather have it do some form of javascript instead of linking to another page. Adding "javascript:voi d(0)" won't flash the page and it will do whatever the onclick is designed to do.

    For your second question, can you please post the code of the function selectDate and whatever other functions make use of it.

    Comment

    • sandeepdesai
      New Member
      • Aug 2007
      • 10

      #3
      Originally posted by divina11
      Can someone explain what the following line does or mean:
      [CODE=javasript]"javascript:voi d(0)"[/CODE]

      The rest of my Calender pop-up code:

      [CODE=javascript]<span onclick='select Date("startdate ")'><a href="javascrip t:void(0)"><img valign="middle" src="http://ai.spirahellic. com/DDL/media/calender_icon.g if" alt="" width="19" height="20" border="0"></a></span>[/CODE]

      Thank you
      Hi..!
      i m still a novice but i think i can answer your question.
      void(0) is a script which does not do anything.
      the request remains the same,the browser does not do anything when this script is executed.
      another way of doing this is using <a href="#" onclick=somethi ng..>
      there is a difference between these two also, which im not sure of..!

      does it work when the onclick attribute is replaced in <a> tag??

      Comment

      • divina11
        New Member
        • Aug 2007
        • 55

        #4
        Thank you guy's I resolved this, as the URL was pointing to the wrong Domain.

        cheers

        Comment

        • iam_clint
          Recognized Expert Top Contributor
          • Jul 2006
          • 1207

          #5
          Originally posted by sandeepdesai
          Hi..!
          i m still a novice but i think i can answer your question.
          void(0) is a script which does not do anything.
          the request remains the same,the browser does not do anything when this script is executed.
          another way of doing this is using <a href="#" onclick=somethi ng..>
          there is a difference between these two also, which im not sure of..!

          does it work when the onclick attribute is replaced in <a> tag??

          # - This can take you to a portion of the page (for people that still use this....)
          javascript: void(0); - javascript: tells the browser that its fixing to use js, then void(0); voids the action. so the page does not move. (this will not scroll you around on the page like # can.)

          Comment

          Working...