www.webdeveloper.com
Results 1 to 4 of 4

Thread: noscript tag validation issues

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,334

    noscript tag validation issues

    I guessed this probably wouldn't be valid mark-up, but thought I'd give it a try anyway:
    HTML Code:
    <div onclick="do_something();">
    	<h2><noscript><a href="go-here.html"></noscript>Foo Bar<noscript></a></noscript></h2>
    	<p>Blah blah blah, yadda yadda yadda.</p>
    </div>
    In case it's not obvious, I wanted to make the title of the element a link on the off chance JavaScript was not enabled. It actually worked as desired in Firefox, but the W3C validator complained. (It does not like starting an element but not closing it within a <noscript> element.)

    So I was just wondering if there was any "better" way to accomplish this that is valid mark-up without becoming an overly complex markup mash-up.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,348
    Think that this valid.

    HTML Code:
    <script>
    alert("Support for JavaScript");
    </script>
    <noscript>
        <a href="go-here.html">Foo Bar</a>
    </noscript>
    http://www.w3.org/TR/html-markup/noscript.html
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,334
    To accomplish what I was trying to do while still being totally valid mark-up, I'd have to do something ugly like:
    HTML Code:
    <div onclick="do_something();">
    	<h2><script type="text/javascript">
    		document.write('Foo Bar');
    	</script><noscript><a href="go-here.html">Foo Bar</a></noscript></h2>
    	<p>Blah blah blah, yadda yadda yadda.</p>
    </div>
    Just seems needlessly ugly and breaking the D.R.Y. principle of programming.

    PS: And probably isn't great with text-to speech tools?
    Last edited by NogDog; 07-18-2014 at 02:49 PM.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,348
    IDK if the <noscript> tags can live at the foot of the document body or not, have you tried that way so its out the way?
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles