[WSG] NoScript Help Please!
Hi, I'm totally hoping that someone can help me with this. I'm trying to use noscript tags but I CANNOT get my page to validate. Below is the section which is giving me trouble. Please can someone tell me what the trouble is. td class=delete_filenoscripta href=a_link.htm/noscript img src=pics/delete.gif alt=Delete File /noscript/a/noscript/td I know it looks odd but this version does exactly what I need. However it refuses to validate. I use XHTML 1.0 strict and do not want to step down to transitional. Unless someone can tell me how to give javascript priority then I need to work this out because if I put the link in on it's own it does the javascript part and then does the link and I only want the link to be activated if javascript is turned off. Please someone help. I'm going crazy! IceKat. -- Nothing is impossible, the impossible just takes longer. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] NoScript Help Please!
Hey, My suggestion would be td class=..a href=...img src=.. alt=.. //a/td And attaching the onclick event to a with return false; to stop it executing when there is javascript. The alternative is to have an onload function that puts the image outside the a and deletes the a element. Both of these will degrade gracefully without needing that ugly noscript Regards, Michael On Wed, May 21, 2008 at 4:11 PM, IceKat [EMAIL PROTECTED] wrote: Hi, I'm totally hoping that someone can help me with this. I'm trying to use noscript tags but I CANNOT get my page to validate. Below is the section which is giving me trouble. Please can someone tell me what the trouble is. td class=delete_filenoscripta href=a_link.htm/noscript img src=pics/delete.gif alt=Delete File /noscript/a/noscript/td I know it looks odd but this version does exactly what I need. However it refuses to validate. I use XHTML 1.0 strict and do not want to step down to transitional. Unless someone can tell me how to give javascript priority then I need to work this out because if I put the link in on it's own it does the javascript part and then does the link and I only want the link to be activated if javascript is turned off. Please someone help. I'm going crazy! IceKat. -- http://mine.mjec.net/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] NoScript Help Please!
On 21 May 2008, at 07:11, IceKat wrote: I'm totally hoping that someone can help me with this. I'm trying to use noscript tags but I CANNOT get my page to validate. Below is the section which is giving me trouble. Please can someone tell me what the trouble is. td class=delete_filenoscripta href=a_link.htm/noscript img src=pics/delete.gif alt=Delete File /noscript/a/ noscript/td Three issues: 1: A start tag starts an element, an end tag ends an element, and elements must be contained entirely within other elements. 2: noscript is a very poor means of handling the 'no js case', it doesn't cope with 'JavaScript supported, but not the functions you are calling' 3: Links make GET requests, and GET requests shouldn't do anything significant to the server (like deleting files). People have run into problems with precaching proxy servers following all the links to get the content available for users and deleting lots of files as they go. For changes to the server, use POST. I would do something like this: form method=POST action=a_link.html class=delete_file div input name=delete type=image src=pics/delete.gif alt=Delete File /div /form And then: script type=text/javascript src=http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js /script script type=text/javascript function deleteFiles(e, obj) { YAHOO.util.Event.preventDefault(e); // Don't submit the form normally // And then whatever else you want your JS to do } var elements = YAHOO.util.Dom.getElementsByClassName('delete_file', 'form'); YAHOO.util.Event.addListener(elements, submit, deleteFiles); /script YUI documentation is available from http://developer.yahoo.com/yui/ -- David Dorward http://dorward.me.uk/ http://blog.dorward.me.uk/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] NoScript Help Please!
Hi, Thanks to those who have replied so far. I'm still a bit lost because this has gotten a bit more complicated so I'll explain a bit. I have a page which lists records in a mysql database. They each have varying options including delete. They are printed with a php loop. The table of records is in a form and the delete button has in fact become a input type=image which posts some data back to the page with a javascript return confirm. The posted data is then excecuted. The php and mysql is fine but the javascript is doing the confirming which means that if it's turned off then there is no confirmation of the delete. This is the reason why I am trying to put in a regular image with a link to another page which only appears if javascript is disabled. I know this isn't a JavaScript help page but I'm hoping that someone will understand my babbling because I'm having trouble getting this to do what I need and validate my page at the same time. The first solution posted by Michael seemed good until I realised it was actually an input type=image that I needed (sorry about that). The solution below seems to do what I need but the complexity of the javascript makes me feel cold. Can anyone either mail me directly to save clogging up this mailing list or point me to a place where I can learn what I need? Does anyone know a good javascript forum? Many Thanks, IceKat David Dorward wrote: Three issues: 1: A start tag starts an element, an end tag ends an element, and elements must be contained entirely within other elements. 2: noscript is a very poor means of handling the 'no js case', it doesn't cope with 'JavaScript supported, but not the functions you are calling' 3: Links make GET requests, and GET requests shouldn't do anything significant to the server (like deleting files). People have run into problems with precaching proxy servers following all the links to get the content available for users and deleting lots of files as they go. For changes to the server, use POST. I would do something like this: form method=POST action=a_link.html class=delete_file div input name=delete type=image src=pics/delete.gif alt=Delete File /div /form And then: script type=text/javascript src=http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js;/script script type=text/javascript function deleteFiles(e, obj) { YAHOO.util.Event.preventDefault(e); // Don't submit the form normally // And then whatever else you want your JS to do } var elements = YAHOO.util.Dom.getElementsByClassName('delete_file', 'form'); YAHOO.util.Event.addListener(elements, submit, deleteFiles); /script YUI documentation is available from http://developer.yahoo.com/yui/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] NoScript Help Please!
Hi IceKat If javascript is required for the link - then write/append it to the page using javascript - then if javascript is being used - no link Cheers Jeff On 22/05/2008, at 1:31 PM, IceKat wrote: Hi, Thanks to those who have replied so far. I'm still a bit lost because this has gotten a bit more complicated so I'll explain a bit. I have a page which lists records in a mysql database. They each have varying options including delete. They are printed with a php loop. The table of records is in a form and the delete button has in fact become a input type=image which posts some data back to the page with a javascript return confirm. The posted data is then excecuted. The php and mysql is fine but the javascript is doing the confirming which means that if it's turned off then there is no confirmation of the delete. This is the reason why I am trying to put in a regular image with a link to another page which only appears if javascript is disabled. I know this isn't a JavaScript help page but I'm hoping that someone will understand my babbling because I'm having trouble getting this to do what I need and validate my page at the same time. The first solution posted by Michael seemed good until I realised it was actually an input type=image that I needed (sorry about that). The solution below seems to do what I need but the complexity of the javascript makes me feel cold. Can anyone either mail me directly to save clogging up this mailing list or point me to a place where I can learn what I need? Does anyone know a good javascript forum? Many Thanks, IceKat David Dorward wrote: Three issues: 1: A start tag starts an element, an end tag ends an element, and elements must be contained entirely within other elements. 2: noscript is a very poor means of handling the 'no js case', it doesn't cope with 'JavaScript supported, but not the functions you are calling' 3: Links make GET requests, and GET requests shouldn't do anything significant to the server (like deleting files). People have run into problems with precaching proxy servers following all the links to get the content available for users and deleting lots of files as they go. For changes to the server, use POST. I would do something like this: form method=POST action=a_link.html class=delete_file div input name=delete type=image src=pics/delete.gif alt=Delete File /div /form And then: script type=text/javascript src=http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js /script script type=text/javascript function deleteFiles(e, obj) { YAHOO.util.Event.preventDefault(e); // Don't submit the form normally // And then whatever else you want your JS to do } var elements = YAHOO.util.Dom.getElementsByClassName('delete_file', 'form'); YAHOO.util.Event.addListener(elements, submit, deleteFiles); /script YUI documentation is available from http://developer.yahoo.com/yui/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
Ian, The only think I would add is a check to make sure that a browser understands the methods you are using. Avoiding an error caused because a browser doesn't understand var container = document.getElementById(copy) is almost as important as making sure that the site works without JavaScript enabled in the first place. like this in the load function? if (!document.getElementsById) return false; Bob *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
Bob Schwartz wrote: like this in the load function? if (!document.getElementsById) return false; Bob Yes, just like that. I think my favourite method (as used by PPK at http://www.quirksmode.org/) is to use the following: var W3CDOM = (document.createElement document.getElementsByTagName); if (!W3CDOM) return; This can be used either inside a function as it is, split so that multiple functions can call it: var W3CDOM = (document.createElement document.getElementsByTagName); function doSomething() { if (!W3CDOM) return; } or as part of an onload event: var W3CDOM = (document.createElement document.getElementsByTagName); window.onload = function () { if (!W3CDOM) return; doSomething(); } function doSomething() { } The same principle can be used to check for more specific things, as with your example: if (!document.getElementById) return; which will stop a script if getElementById (note the singular of Element) is not supported. Ian. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
Thanks, I'll update my code. Getting there and learning in the process. Bob Schwartz wrote: like this in the load function? if (!document.getElementsById) return false; Bob Yes, just like that. I think my favourite method (as used by PPK at http://www.quirksmode.org/) is to use the following: var W3CDOM = (document.createElement document.getElementsByTagName); if (!W3CDOM) return; This can be used either inside a function as it is, split so that multiple functions can call it: var W3CDOM = (document.createElement document.getElementsByTagName); function doSomething() { if (!W3CDOM) return; } or as part of an onload event: var W3CDOM = (document.createElement document.getElementsByTagName); window.onload = function () { if (!W3CDOM) return; doSomething(); } function doSomething() { } The same principle can be used to check for more specific things, as with your example: if (!document.getElementById) return; which will stop a script if getElementById (note the singular of Element) is not supported. Ian. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
[WSG] noscript
What are currently accepted practices for using noscript for serving content to those with js turned off? In particular I'm talking about eye candy things on a web page that do not take away from the content if the non js visitor is served a static equivalent as opposed to a you need js to see this or whatever. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
On 5 Mar 2007, at 13:52:35, Bob Schwartz wrote: What are currently accepted practices for using noscript for serving content to those with js turned off? In particular I'm talking about eye candy things on a web page that do not take away from the content if the non js visitor is served a static equivalent as opposed to a you need js to see this or whatever. The noscript element is generally frowned upon nowadays, as being against the spirit of using JS for progressive enhancement. Basically, if the content should be there for non-JS enabled viewers (which includes search engines), then there is no need to place it in a noscript element. If it should not be seen by those with JS enabled, then JS should be used to remove it, or replace it. Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
Bob Schwartz wrote: What are currently accepted practices for using serving content to those with js turned off? In particular I'm talking about eye candy things on a web page that do not take away from the content if the non js visitor is served a static equivalent as opposed to a you need js to see this or whatever. Hi Bob, Best practice would be to avoid noscript where at all possible. Start by assuming that the user does not have JavaScript enabled, so that the simple version is part of the content, then use JavaScript to hide or modify this to show your enhanced version. Ian. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
Nick, Ian, Like this: function copy() { var container = document.getElementById(copy) var oldtext = document.getElementById(copy1) var text = (\251 + (new Date()).getFullYear() + F\351d \351ration Internationale F\351line); var p = document.createElement(p); container.replaceChild(p, oldtext); p.appendChild(document.createTextNode(text)); document.getElementById(copy).appendChild(p); } html div id=copyp id=copy1copy; 2007 Fédération Internationale Féline/p/div On 5 Mar 2007, at 13:52:35, Bob Schwartz wrote: What are currently accepted practices for using noscript for serving content to those with js turned off? In particular I'm talking about eye candy things on a web page that do not take away from the content if the non js visitor is served a static equivalent as opposed to a you need js to see this or whatever. The noscript element is generally frowned upon nowadays, as being against the spirit of using JS for progressive enhancement. Basically, if the content should be there for non-JS enabled viewers (which includes search engines), then there is no need to place it in a noscript element. If it should not be seen by those with JS enabled, then JS should be used to remove it, or replace it. Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
Best practice would be to avoid noscript where at all possible. Start by assuming that the user does not have JavaScript enabled, so that the simple version is part of the content, then use JavaScript to hide or modify this to show your enhanced version. I'm curious if you'd (both singular and plural) be against my recent use of noscript. I have a web app that has a toolbar across the top. While editing information using this app, the toolbar contains Save and Cancel buttons. However, the form is below the toolbar. I have unobtrusive javascript use DOM to create the Save button, and then at the bottom of the form, i have a normal submit button inside a noscript. So if javascript is enabled, you get the Save button in the toolbar where it would be expected, and if not, it gracefully degrades to having a standard submit button in the form. I figured this would be the most accessible option The only other option I could think of would be to use DOM to remove the normal submit button when the Save button is created, but would there be any benefit to doing that over using noscript? *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
On 5 Mar 2007, at 17:35:22, Kenny Graham wrote: Best practice would be to avoid noscript where at all possible. Start by assuming that the user does not have JavaScript enabled, so that the simple version is part of the content, then use JavaScript to hide or modify this to show your enhanced version. I'm curious if you'd (both singular and plural) be against my recent use of noscript. I have a web app that has a toolbar across the top. While editing information using this app, the toolbar contains Save and Cancel buttons. However, the form is below the toolbar. I have unobtrusive javascript use DOM to create the Save button, and then at the bottom of the form, i have a normal submit button inside a noscript. So if javascript is enabled, you get the Save button in the toolbar where it would be expected, and if not, it gracefully degrades to having a standard submit button in the form. I figured this would be the most accessible option The only other option I could think of would be to use DOM to remove the normal submit button when the Save button is created, but would there be any benefit to doing that over using noscript? Yes, because you wouldn't be using noscript :-) If you think about it, given that you can easily remove the extra button if JS is enabled, there is no real reason for the use of noscript: a script-incapable viewer will see the button anyway, and a script-enabled viewer won't, because the script removed it. So you aren't getting any advantage from the use of noscript. Incidentally, if scripting is enabled, you can just take the submit button and move ot up to the toolbar, thereby saving yourself the trouble of creating it. Personally, I would have the toolbar be part of the form anyway, although I appreciate there may be reasons why this wouldn't work. But I wonder just how well a screenreader user, trying to use the browser in form mode, will be able to deal with a form that has had its submit button moved out of the form. FWIW, noscript is also deprecated in XHTML 2 (if that ever arrives). Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript
Bob Schwartz wrote: Nick, Ian, Like this: function copy() { var container = document.getElementById(copy) var oldtext = document.getElementById(copy1) var text = (\251 + (new Date()).getFullYear() + F\351d \351ration Internationale F\351line); var p = document.createElement(p); container.replaceChild(p, oldtext); p.appendChild(document.createTextNode(text)); document.getElementById(copy).appendChild(p); } html div id=copyp id=copy1copy; 2007 Fédération Internationale Féline/p/div Yes, much better. I don't want to get in to conversation about the different ways this could have been done, because there is nothing wrong with this. There are ways you could of saved a few bytes here and there, but it makes sense to you and does the job. The only think I would add is a check to make sure that a browser understands the methods you are using. Avoiding an error caused because a browser doesn't understand var container = document.getElementById(copy) is almost as important as making sure that the site works without JavaScript enabled in the first place. To answer Kenny's question and further to Nick's point, I think using noscript is also a sign of thinking about JavaScript the wrong way around. When you are putting your site together you are already thinking about what you need to do to essentially fix what you have done if a user does not have JavaScript for one reason or another, but I think you will write better code if you do things the other way round. Make your site functional, and then add the scripted bells and whistles. You can plan for it in advance, but make your first pass all about basic usability. Another point that is often mentioned in these discussions is that the noscript approach causes problems in situations when a browser has JavaScript capability, but your code is being stripped out before it gets there. Libraries and work place systems are often cited as examples where this could happen. I'm sure there are uses for noscript (to track numbers of users without JavaScript enabled should you for some reason need to, for example), but there aren't many, and as it is not too difficult to achieve the same effect with well written JavaScript I can't really see the point of using it. Ian. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] noscript in xhtml1.0 strict
On Thu, 16 Dec 2004 16:37:49 +0100, Nick Verstappen [EMAIL PROTECTED] wrote: Is the noscript tag not allowed anymore in XHTML 1.0 Strict? I'm trying to use it, but it does not validate. If it IS allowed, what markup should I use to make it validate? Many thanks! Ofcourse it is allowed. XHTML just enforces that noscript block element and must have block content (same with blockquote) pnoscriptbla/noscript/p is illegal, but noscriptpbla/p/noscript is just right. -- regards, Kornel Lesiski ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] noscript in xhtml1.0 strict
Nick Verstappen wrote: Is the noscript tag not allowed anymore in XHTML 1.0 Strict? I'm trying to use it, but it does not validate. If it IS allowed, what markup should I use to make it validate? Many thanks! Nick, you need to format it like this: div script type='text/javascript' src='java.js'/script noscript diva href=nojava.htmlNo JavaScript user link/a/div /noscript /div you can ignore the outer wrapper div if you wish, but i like to keep them all in one 'block' ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] noscript in xhtml1.0 strict
Brian Cummiskey wrote: div script type='text/javascript' src='java.js'/script noscript diva href=nojava.htmlNo JavaScript user link/a/div /noscript /div Even better would be to remove the script tag from the body and put it in the head (with the code itself in an external file). As far as the containing div goes, unless you're grouping the noscript with elements, it's unneeded. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
[WSG] noscript in xhtml1.0 strict
Is the noscript tag not allowed anymore in XHTML 1.0 Strict? I'm trying to use it, but it does not validate. If it IS allowed, what markup should I use to make it validate? Many thanks! Nick ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **