最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Where are these empty anchor tags coming from? - Stack Overflow

programmeradmin5浏览0评论

I'm getting empty tags in my page that aren't in the page source, but are visible upon inspecting the element via firebug. I've disabled javascript to see if that was injecting it, as well as disabling all add-ons. Here is an excerpt from the page source, free of random <a></a>:

...
<div class="middle-content">
     <div class="asu_set_fixed_width">
      <div id="navbar">
       <div id="navbar-inner" class="clear-block region region-navbar">
        <div class="region region-navbar">
         <div id="block-menu-primary-links" class="block block-menu first last region-odd odd region-count-1 count-1">
          <div class="content">
           <ul class="menu"><li class="leaf first active-trail"><a href="/index" title="Home" class="active">Home</a></li>
            <li class="leaf"><a href="/About_CUbiC" title="About CUbiC">About CUbiC</a></li>
...

and now examining with firebug with javascript disabled: Same thing happens in Chrome as it does here in Firefox. Any thoughts on where these are ing from?

I'm getting empty tags in my page that aren't in the page source, but are visible upon inspecting the element via firebug. I've disabled javascript to see if that was injecting it, as well as disabling all add-ons. Here is an excerpt from the page source, free of random <a></a>:

...
<div class="middle-content">
     <div class="asu_set_fixed_width">
      <div id="navbar">
       <div id="navbar-inner" class="clear-block region region-navbar">
        <div class="region region-navbar">
         <div id="block-menu-primary-links" class="block block-menu first last region-odd odd region-count-1 count-1">
          <div class="content">
           <ul class="menu"><li class="leaf first active-trail"><a href="/index" title="Home" class="active">Home</a></li>
            <li class="leaf"><a href="/About_CUbiC" title="About CUbiC">About CUbiC</a></li>
...

and now examining with firebug with javascript disabled: Same thing happens in Chrome as it does here in Firefox. Any thoughts on where these are ing from?

Share Improve this question asked Jun 23, 2011 at 2:06 cmikeb1cmikeb1 1,06410 silver badges19 bronze badges 6
  • I'm confused. You said you disabled JavaScript but you didn't say what the result was. Point being: Is this situation being caused by JS or not? – Sparky Commented Jun 23, 2011 at 2:08
  • The problem persists with JS disabled, the results above are with no JavaScript running. – cmikeb1 Commented Jun 23, 2011 at 2:10
  • 1 @CMike what I'm looking at is not empty. – user456814 Commented Jun 23, 2011 at 2:10
  • @CMike this is what I see inside the <a> element, <li class="leaf first active-trail"><a href="/index" title="Home" class="active">Home</a></li> . – user456814 Commented Jun 23, 2011 at 2:11
  • 1 Got it, simple syntax error and the browser was creating the empty <a></a> tags to try and pensate for the mismatched elements. Next time I will use a validator, thanks for the advice! – cmikeb1 Commented Jun 23, 2011 at 2:21
 |  Show 1 more ment

3 Answers 3

Reset to default 7

Validate your HTML.

http://validator.w3/check?uri=http%3A%2F%2Fcubic-dev.asu.edu%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

  • end tag for "a" omitted
  • start tag was here
  • etc..

The snippet of HTML in question is this (I added line breaks):

<a href="#">
    <img id="cubic-header-newsletter-img" src='..' alt='..'.>
<a>

There should be an </a> at the end there instead of <a>.

Line 195:

        <a href="#"><img id="cubic-header-newsletter-img" src='/sites/all/themes/asuzen/images/newsletter_pic.png' alt='Newsletter imgae, click here for newsletter'.><a>

I think you mean:

... newsletter'></a>

and not:

.... newsletter'.><a>

I'm not seeing that in Safari's Error Console but it does not look like you've disabled all of your JavaScript.

This is an error I'm seeing:

Unsafe JavaScript attempt to access frame with URL http://cubic-dev.asu.edu/ from frame with URL http://www.youtube./embed/KiHrxGnVjLg?rel=0&controls=0. Domains, protocols and ports must match.

EDIT:

Also, as stated by thirtydot, you must Validate your code.

发布评论

评论列表(0)

  1. 暂无评论