Results 1 to 4 of 4

Thread: Javascript for replacing a target tag in a form for XHTML Strict?

  1. #1
    Join Date
    Oct 2004
    Location
    MN, USA
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Javascript for replacing a target tag in a form for XHTML Strict?

    I am getting a warning that I cannot use a target tag in a form for strict XHTML, I am sure there is a way to do this using javascript, but I just don't know enough to code it myself. Any suggestions? Here is my code:

    Code:
    <form action="http://www.feedburner.com/fb/a/emailverify" method="post" target="popupwindow" 
    onsubmit="window.open('http://www.feedburner.com', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
    <p>Enter your email address here:<br />
    <input type="text" style="width:119px" name="email" />
    <input type="hidden" value="http://feeds.feedburner.com/~e?ffid=990626" name="url" />
    <input type="hidden" value="Read-How.com - The Entrepreneurial Products Super Store!" name="title" />
    <input type="hidden" name="loc" value="en_US" />
    <input type="submit" value="Subscribe" />
    </p></form>
    Thanks!

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You probably don't want to use XHTML -- it's not yet supported by IE.

    target is invalid in strict HTML too. To load in a new, named window:
    Code:
    onclick="open(this.href, 'window_name');"
    This is equivalent to:
    Code:
    target="window_name"
    For a frame (although you obviously can't use frames in Strict DOCTYPEs, just for reference):
    Code:
    onclick="frames['frame_name'].location.href = this.href;"
    Then there are the special ones: _self:
    Code:
    onclick="location.href = this.href;"
    _top:
    Code:
    onclick="top.location.href = this.href;"
    _parent:
    Code:
    onclick="parent.location.href = this.href;"
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Oct 2004
    Location
    MN, USA
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Twey,

    Thanks for the help. Can I ask for a bit more? How would I actually use the options you outlined in my code? I already have a an onsubmit deal so I am not sure how to incorporate your suggestions.

    Code:
    <form action="http://www.feedburner.com/fb/a/emailverify" method="post" target="popupwindow" 
    onsubmit="window.open('http://www.feedburner.com', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
    Also, I am not sure what you meant by XHTML is not supported by IE? I am actually using Expression Web with the setting of IE 6 & Strict XHTML version 1.0 as my rules validation.

    Thanks!

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Oh, I see, you have the target attribute on a form... that's a lot trickier, and would probably involve some serious application of XMLHttpRequest. If I were you, I'd leave it and submit to the same window.
    Also, I am not sure what you meant by XHTML is not supported by IE? I am actually using Expression Web with the setting of IE 6 & Strict XHTML version 1.0 as my rules validation.
    I suspect your server is probably sending it as HTML (text/html) instead of XHTML (application/xhtml+xml). Thus, browsers won't actually attempt to parse it as XHTML, they'll see it as invalid HTML.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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