[WSG] javascript and no script -- best practices
thanks for the citehelp/cite with my last question. now i have a page with javascript opening a new window from a link. the reason for this is that i want to allow the visitor to close the window and still be at the site from whence they came. my problem and question is. what is the best practice for allowing someone to click the link and go to the site with js disabled? here's the script: a href=JavaScript: void(0) onclick=window.open('pagename.htm', '_blank', 'optionlist')link text/a hope all of you are having a smashing weekend. dwain -- Dwain Alford [EMAIL PROTECTED] http://www.alforddesigngroup.com The Teacher answered: There is no sin. 'The Gospel of Mary of Magdala' ** 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] javascript and no script -- best practices
On Sun, 21 Aug 2005 04:35:50 -0500, dwain alford wrote: here's the script: a href=JavaScript: void(0) onclick=window.open('pagename.htm', '_blank', 'optionlist')link text/a E! Not a good method, that. How about: a href=/dir/to/target.html onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a This well work nicely if JS is off :) I think the main 'debatable point' is whether or not negating the window.open works. (written from memory - needs testing) I like: http://www.sitepoint.com/print/perfect-pop-up as reference material. HIH Lea -- Lea de Groot Elysian Systems - http://elysiansystems.com/ Brisbane, Australia ** 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] javascript and no script -- best practices
There's an article for accessible popups over at http://www.alistapart.com/articles/popuplinks/ The code you posted has some issues that will need to be dealt with. thanks for the citehelp/cite with my last question. now i have a page with javascript opening a new window from a link. the reason for this is that i want to allow the visitor to close the window and still be at the site from whence they came. my problem and question is. what is the best practice for allowing someone to click the link and go to the site with js disabled? here's the script: a href=JavaScript: void(0) onclick=window.open('pagename.htm', '_blank', 'optionlist')link text/a hope all of you are having a smashing weekend. dwain ** 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] javascript and no script -- best practices
Lea de Groot wrote: How about: a href=/dir/to/target.html onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a This well work nicely if JS is off :) I think the main 'debatable point' is whether or not negating the window.open works. (written from memory - needs testing) I like: http://www.sitepoint.com/print/perfect-pop-up as reference material. HIH Lea thanks lea for your quick response. do i insert the js (all of it) as written with the this.href being the page i want to go to? dwain -- Dwain Alford [EMAIL PROTECTED] http://www.alforddesigngroup.com The Teacher answered: There is no sin. 'The Gospel of Mary of Magdala' ** 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] javascript and no script -- best practices
On Sun, 21 Aug 2005 05:04:15 -0500, dwain alford wrote: thanks lea for your quick response. do i insert the js (all of it) as written with the this.href being the page i want to go to? No, no - thats the whole 'trick' to this. You only type the real url (in my example '/dir/to/target.html') once, in the regular href= position. Then the javascript uses an internal property 'this.href' to get the href from the current object. Its quite nifty. So, where you had: a href=JavaScript: void(0) onclick=window.open('pagename.htm', '_blank', 'optionlist')link text/a I would put: a href=pagename.htm onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a this means that folks without javascript effectively get: a href=pagename.htmlink text/a and people with js get the popup. and because we return a false when the popup executes correctly they do not get moved on in the current window. What a long explanation for such a simple concept :) Lea -- Lea de Groot Elysian Systems - http://elysiansystems.com/ Brisbane, Australia ** 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] javascript and no script -- best practices
Lea de Groot wrote: On Sun, 21 Aug 2005 05:04:15 -0500, dwain alford wrote: thanks lea for your quick response. do i insert the js (all of it) as written with the this.href being the page i want to go to? No, no - thats the whole 'trick' to this. You only type the real url (in my example '/dir/to/target.html') once, in the regular href= position. Then the javascript uses an internal property 'this.href' to get the href from the current object. Its quite nifty. So, where you had: a href=JavaScript: void(0) onclick=window.open('pagename.htm', '_blank', 'optionlist')link text/a I would put: a href=pagename.htm onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a this means that folks without javascript effectively get: a href=pagename.htmlink text/a and people with js get the popup. and because we return a false when the popup executes correctly they do not get moved on in the current window. What a long explanation for such a simple concept :) Lea ok, all is clear. i don't know nothin' bout writtin no javascript lea. -- Dwain Alford [EMAIL PROTECTED] http://www.alforddesigngroup.com The Teacher answered: There is no sin. 'The Gospel of Mary of Magdala' ** 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] javascript and no script -- best practices
Lea de Groot wrote: I would put: a href=pagename.htm onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a this works ok, terrific would be if the window that opened allowed you to maximize it or opened maximized with scroll bars. the page with this code is up at: http://www.alforddesigngroup.com/sandbox/resources.html dwain -- Dwain Alford [EMAIL PROTECTED] http://www.alforddesigngroup.com The Teacher answered: There is no sin. 'The Gospel of Mary of Magdala' ** 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] javascript and no script -- best practices
Lea de Groot wrote: I would put: a href=pagename.htm onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a this means that folks without javascript effectively get: a href=pagename.htmlink text/a and people with js get the popup. and because we return a false when the popup executes correctly they do not get moved on in the current window. What a long explanation for such a simple concept :) thanks for the snippet. the window opens, but it is small and does not offer a maximization setting or scroll bars. what do i need to add to the code for the window to open maximized or be able to be maximized? i realize that this is coding 101, but i'm coming from the remedial coding group. ;^) dwain -- Dwain Alford [EMAIL PROTECTED] http://www.alforddesigngroup.com The Teacher answered: There is no sin. 'The Gospel of Mary of Magdala' ** 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] javascript and no script -- best practices
a href=pagename.htm onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a thanks for the snippet. the window opens, but it is small and does not offer a maximization setting or scroll bars. what do i need to add to the code for the window to open maximized or be able to be maximized? Leave out the 'optionlist' parameter. -- Jan Brasna aka JohnyB :: www.alphanumeric.cz | www.janbrasna.com ** 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] javascript and no script -- best practices
Jan Brasna wrote: a href=pagename.htm onclick=return !window.open(this.href, 'awindow', 'optionlist');link text/a thanks for the snippet. the window opens, but it is small and does not offer a maximization setting or scroll bars. what do i need to add to the code for the window to open maximized or be able to be maximized? Leave out the 'optionlist' parameter. jan, very much appreciate the words. they did the trick, of course you knew that. will you point me in the direction for my next addition? i want the visitor to be able to tab through the links. i don't know how this is done. references? dwain -- Dwain Alford [EMAIL PROTECTED] http://www.alforddesigngroup.com The Teacher answered: There is no sin. 'The Gospel of Mary of Magdala' ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **