Re: [WSG] Replacing target attribute in form
On 13 Nov 2006, at 21:45:07, Christian Montoya wrote: On 11/13/06, Chris Price [EMAIL PROTECTED] wrote: I don't suppose there's any reason why I shouldn't keep coding to xhtml 1.0 but specify html 4.01 when I need to use the target attribute. That might be a good idea; on the *one* page that uses the target attribute, use the HTML 4.01 doctype (with .. instead of .. /) and you'll never have to worry about maintaining any javascript hacks. Use of the target attribute has nothing to do with use of HTML versus XHTML; it's a matter of using Transitional versus Strict doctypes. XHTML 1.0 Transitional and HTML 4.01 Transitional include the target attribute; XHTML 1.0 Strict and HTML 4.01 Strict don't. From the XHTML 1.0 Transitional DTD: http://www.w3.org/TR/xhtml1/ dtds.html#dtdentry_xhtml1-transitional.dtd_a 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] Replacing target attribute in form
I have a little online store paying through Paypal, using their shopping cart. So the buy button opens up a new window and you're into Paypal. Hi - i've been looking at PayPal lately and thought i haven't done a cart I've seen that PayPal automatically sets the target in the form. If I was setting one up, I would just take that out (test to make sure it still worked, I would think it would) and then you'd just be opening in the same window, which feels much better. best Donna -- Donna Jones Portland, Maine 207 772 0266 http://www.westendwebs.com/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
On Monday, November 13, 2006, at 08:02 am, Donna Jones wrote: Hi - i've been looking at PayPal lately and thought i haven't done a cart I've seen that PayPal automatically sets the target in the form. If I was setting one up, I would just take that out (test to make sure it still worked, I would think it would) and then you'd just be opening in the same window, which feels much better. I've tried using the same window but when using the new window a 'continue shopping' button appears which is not there when using the same window. Concerning the other posts, I would go along with the html 4.01 option because that doesn't fudge the standards issue. Having said that, using the Paypal cart is not my ideal solution so there is a case for using the transitional standard. I don't suppose there's any reason why I shouldn't keep coding to xhtml 1.0 but specify html 4.01 when I need to use the target attribute. I have seen the script that Andy posted and felt it was a hammer to crack a nut. I already have a script for opening a new window. I don't want to start a rerun of the javascript fudging standards argument but does anyone have the url of a favourite article on the subject? Thanks for everyone who's posted. Its given me food for thought. -- Chris Price *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
On Mon, Nov 13, 2006 at 10:57:19AM +, Chris Price wrote: I don't suppose there's any reason why I shouldn't keep coding to xhtml 1.0 but specify html 4.01 when I need to use the target attribute. You seem to be confusing HTML/XHTML with Strict/Transitional. XHTML 1.0 and HTML 4.01 are identical save for some changes made to make it use XML syntax (and some other undocumented changes). -- David Dorward http://dorward.me.uk *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
RE: [WSG] Replacing target attribute in form
What is the point of leaving out the 'target' attribute if you are then going to put it in via JavaScript? If it shouldn't be there then don't use it - sneaking it in via a script seems rather pointless to me. Mike -Original Message- From: listdad@webstandardsgroup.org [mailto:[EMAIL PROTECTED] On Behalf Of Andy Woznica Essentially it's a script to open all external links in a new window with a slight modification to recognise a substring in a form tag and do likewise. Anyway, here's the JavaScript: // JavaScript Document function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName(a); for (var i=0; ianchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute(href) anchor.getAttribute(rel) == external) anchor.target = _blank; } var forms = document.getElementsByTagName(form); for(var i = 0; i forms.length; i++) { var form = forms[i]; if(form.getAttribute(id).substring(0, 6) == paypal) { form.target = _blank; } } } *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
Chris Price wrote: I don't want to start a rerun of the javascript fudging standards argument but does anyone have the url of a favourite article on the subject? That's my favourite one, but I'm a little bit biased :) http://www.tjkdesign.com/articles/popup_window_with_no_extra_markup.asp --- Regards, Thierry | www.TJKDesign.com *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
Indeed, probably so. It was just a suggestion. A - Andy Woznica Actofdesign http://www.actofdesign.com On 11/13/06 10:17 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: What is the point of leaving out the 'target' attribute if you are then going to put it in via JavaScript? If it shouldn't be there then don't use it - sneaking it in via a script seems rather pointless to me. Mike -Original Message- From: listdad@webstandardsgroup.org [mailto:[EMAIL PROTECTED] On Behalf Of Andy Woznica Essentially it's a script to open all external links in a new window with a slight modification to recognise a substring in a form tag and do likewise. Anyway, here's the JavaScript: // JavaScript Document function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName(a); for (var i=0; ianchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute(href) anchor.getAttribute(rel) == external) anchor.target = _blank; } var forms = document.getElementsByTagName(form); for(var i = 0; i forms.length; i++) { var form = forms[i]; if(form.getAttribute(id).substring(0, 6) == paypal) { form.target = _blank; } } } *** 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] Replacing target attribute in form
On 11/13/06, Chris Price [EMAIL PROTECTED] wrote: I don't suppose there's any reason why I shouldn't keep coding to xhtml 1.0 but specify html 4.01 when I need to use the target attribute. That might be a good idea; on the *one* page that uses the target attribute, use the HTML 4.01 doctype (with .. instead of .. /) and you'll never have to worry about maintaining any javascript hacks. -- -- Christian Montoya christianmontoya.com ... portfolio.christianmontoya.com *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
[WSG] Replacing target attribute in form
Hi I have a little online store paying through Paypal, using their shopping cart. So the buy button opens up a new window and you're into Paypal. Unfortunately the bit of html for the form uses 'target' to open up the window and I'm coding in xhtml strict. I'm using onclick=newWindow() return false for opening new windows. I'm looking for a simple bit of javascript to do the same for the form, something like form.target = window.open() Any ideas? Kind Regards -- Chris Price Choctaw [EMAIL PROTECTED] http://www.choctaw.co.uk Tel. 01524 825 245 Mob. 0777 451 4488 Beauty is in the eye of the beholder while excellence is in the hand of the professional ~~~ -+- Sent on behalf of Choctaw Media Ltd -+- ~~~ The information in the email (including any attachments) is confidential and intended solely for the use of the individual to whom it is addressed. Access to this email by anyone else is unauthorized. Any views or opinions presented are solely those of the author and do not necessarily represent those of Choctaw Media Ltd. If you have received this email in error be advised that any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Please notify the sender and please delete the message from your system immediately. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
RE: [WSG] Replacing target attribute in form
I'm looking for a simple bit of javascript to do the same for the form, something like form.target = window.open() Hi Chris, You could create a javascript function and then call it from within the action attribute of the form tag: script function test() { window.open(...); } /script form name=testForm action=javascript:test(); ... /form My other question would be do you really need to open a separate window to go to PayPal? I haven't used this feature, but if PayPal will return you eventually to your site, couldn't you just go there in the same window? Just a thought. Regards, Kepler Gelotte http://www.neigborwebmaster.com *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
RE: [WSG] Replacing target attribute in form
Try this a href=http://google.com/; onclick=window.open(this.href); return false; A Test Link /a It achieves your objective of opening a new window, but it also: * Preserves the href element for Search Engines * Users who want control can still right-click * The link can still be Bookmarked or added to the browser Favorites * Your code will validate Robin Take control of your website - ask me today about Xsite-tomorrows Content Management System CONFIDENTIALITY: This e-mail and any attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose, or store or copy the information in any medium. -Original Message- From: listdad@webstandardsgroup.org [mailto:[EMAIL PROTECTED] On Behalf Of Chris Price Sent: Monday, 13 November 2006 6:58 a.m. To: wsg@webstandardsgroup.org Subject: [WSG] Replacing target attribute in form Hi I have a little online store paying through Paypal, using their shopping cart. So the buy button opens up a new window and you're into Paypal. Unfortunately the bit of html for the form uses 'target' to open up the window and I'm coding in xhtml strict. I'm using onclick=newWindow() return false for opening new windows. I'm looking for a simple bit of javascript to do the same for the form, something like form.target = window.open() Any ideas? Kind Regards -- Chris Price Choctaw [EMAIL PROTECTED] http://www.choctaw.co.uk Tel. 01524 825 245 Mob. 0777 451 4488 Beauty is in the eye of the beholder while excellence is in the hand of the professional ~~~ -+- Sent on behalf of Choctaw Media Ltd -+- ~~~ The information in the email (including any attachments) is confidential and intended solely for the use of the individual to whom it is addressed. Access to this email by anyone else is unauthorized. Any views or opinions presented are solely those of the author and do not necessarily represent those of Choctaw Media Ltd. If you have received this email in error be advised that any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Please notify the sender and please delete the message from your system immediately. *** 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] Replacing target attribute in form
Robin @ Xplore.net wrote: a href=http://google.com/; onclick=window.open(this.href); return false; A Test Link /a Doesn't answer the actual question about how to do it in forms, though... P -- Patrick H. Lauke __ re·dux (adj.): brought back; returned. used postpositively [latin : re-, re- + dux, leader; see duke.] www.splintered.co.uk | www.photographia.co.uk http://redux.deviantart.com __ Web Standards Project (WaSP) Accessibility Task Force http://webstandards.org/ __ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
On 11/12/06, Kepler Gelotte [EMAIL PROTECTED] wrote: I'm looking for a simple bit of javascript to do the same for the form, something like form.target = window.open() ... My other question would be do you really need to open a separate window to go to PayPal? I haven't used this feature, but if PayPal will return you eventually to your site, couldn't you just go there in the same window? Just a thought. Agreed. It's more natural for the user if you just allow Paypal to work in the same window and then have it redirect back to your site when the transaction is done. You could even have it redirect to a thank you page. Otherwise, a great solution is to stop trying to fake the standards and just use HTML 4.01... it's clean, well-supported, and it allows targets. No need to rely on Javascript for something that was never broken. -- -- Christian Montoya christianmontoya.com ... portfolio.christianmontoya.com *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
Christian Montoya wrote: Otherwise, a great solution is to stop trying to fake the standards and just use HTML 4.01... it's clean, well-supported, and it allows targets. XHTML 1.0 allows the target attribute too in the Transitional DOCTYPE. Don't confuse the syntax of HTML and XHTML with the distinction between the Strict and Transitional DOCTYPEs. Although I do agree that HTML should be used instead of XHTML for many other reasons, I think it's an exceptionally bad idea to attempt to open a new window. But, if you insist on doing so, use a Transitional DOCTYPE with the target attribute because at least that way the user can more easily configure their browser to ignore it. -- Lachlan Hunt http://lachy.id.au/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
On 11/12/06, Lachlan Hunt [EMAIL PROTECTED] wrote: Christian Montoya wrote: Otherwise, a great solution is to stop trying to fake the standards and just use HTML 4.01... it's clean, well-supported, and it allows targets. XHTML 1.0 allows the target attribute too in the Transitional DOCTYPE. Don't confuse the syntax of HTML and XHTML with the distinction between the Strict and Transitional DOCTYPEs. Although I do agree that HTML should be used instead of XHTML for many other reasons, I think it's an exceptionally bad idea to attempt to open a new window. But, if you insist on doing so, use a Transitional DOCTYPE with the target attribute because at least that way the user can more easily configure their browser to ignore it. That would be an abuse of the transitional doctype though, which is intended for old, existing pages that are being ported to XHTML strict, rather than new pages in development. It would be silly for Chris to use that doctype, because that would be to indicate that he plans on removing the target attributes, which in my recommendation, he does not. I'm not confusing HTML and XHTML with the distinction between strict and transitional; transitional doesn't belong in the discussion to begin with. -- -- Christian Montoya christianmontoya.com ... portfolio.christianmontoya.com *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] Replacing target attribute in form
Chris, I had exactly the same issue and this was the solution I found. Essentially it's a script to open all external links in a new window with a slight modification to recognise a substring in a form tag and do likewise. Anyway, here's the JavaScript: // JavaScript Document function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName(a); for (var i=0; ianchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute(href) anchor.getAttribute(rel) == external) anchor.target = _blank; } var forms = document.getElementsByTagName(form); for(var i = 0; i forms.length; i++) { var form = forms[i]; if(form.getAttribute(id).substring(0, 6) == paypal) { form.target = _blank; } } } You'll need to put the script in the head tag or link to it: script type=text/javascript src=links.js/script and add trigger it onload in the body tag : body onload=externalLinks(); After that, any link with rel=external in the href tag or any form with id=paypal in the form tag will open in a new window and the code will validate as XHTML strict. It worked for me. Hope it helps. I wish I could remember where I found it, but I can't. There are a few more similar scripts out there. Andy - Andy Woznica Actofdesign http://www.actofdesign.com On 11/12/06 12:57 PM, Chris Price [EMAIL PROTECTED] wrote: Hi I have a little online store paying through Paypal, using their shopping cart. So the buy button opens up a new window and you're into Paypal. Unfortunately the bit of html for the form uses 'target' to open up the window and I'm coding in xhtml strict. I'm using onclick=newWindow() return false for opening new windows. I'm looking for a simple bit of javascript to do the same for the form, something like form.target = window.open() Any ideas? Kind Regards *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***