Jump to content

Recommended Posts

Pretty sketchy question here.  What does the anchor tag do for you exactly?  Not much as written.  Is that your question?  I mean - you posted 3 lines of code and asked about it but didn't state which line you wanted our opinion on.

 

Really - try to be more specific next time.

For what it's worth, some would suggest that you avoid inline JavaScript. The "onload" attribute, for example, could be replaced with JavaScript's window.onload event handler. More information can be found here:

https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onload

 

For more information as to why you might want to switch, you could research "Unobtrusive JavaScript". The following article will get you started:

http://en.wikipedia.org/wiki/Unobtrusive_JavaScript

If you meant you wanted the javascript outside of the body tag, then maybe this would be what you wanted.  Left the option for adding more JS after load rather than just one function called, but there's tons of ways to do that.

 

 

<head>
    <script type="text/javascript">
        // Wait for load
        window.addEventListener("load", function()
        {
            // Do whatever ..
            getParameterByName("url");
        }, false);
    </script>
</head>

<body>
    <!-- Added "#" as target to avoid moving pages without JS -->
    <a href="#" id="urllink">Click Here</a>
</body>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.