The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> form results in new window (strictly speaking)
jimlongo
post Oct 2 2006, 12:20 PM
Post #1


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



I use this code to put a Google search on some pages
HTML
<form method=GET action="http://www.google.com/search" target="_blank">
<div><input type=hidden name=ie value=iso-8859-1></div>
<div><input type=hidden name=oe value=iso-8859-1></div>
<table><tr><td>
<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_40wht.gif" alt="Google"></a>
</td>
<td>
<input type=text name=q size=31 maxlength=255 value="">
<input type=submit name=btnG VALUE="Google Search">
<input type=hidden name=domains value="domain.com"><br> <input type=radio name=sitesearch value="domain.com" checked> domain.com<img src="images/spacer.gif" height="1" width="15" alt=""> <input type=radio name=sitesearch value=""> www<br>
</td></tr></table>
</form>


I want to remove the target="_blank" from there but still have it open in another window.


this is the javascript I normally use to open a link in a new window . . .
CODE
<a href="http://www.someplace.com"  onclick="java script:openWin('http://www.someplace.com'); return false">


Is there a way to combine this to make the search results open in a new window when I'm using a angry.gif STRICT DOCTYPE?mad.gif

Thanks,
jim
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
jimlongo
post Oct 2 2006, 02:53 PM
Post #2


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



I got that TARGET is a no-no, so that's why i'm trying to inject some javascript in the form. But I can't seem to get it to work, I've tried onclick in the submit section
CODE

<input type=submit name=btnG VALUE="Google Search" onclick="java script:openWin('http://www.google.com/search'); return false">


and onsubmit
CODE

<input type=submit name=btnG VALUE="Google Search" onsubmit="java script:openWin('http://www.google.com/search'); return false">


and I've tried it in the action line in place of target="_blank" as well but none of those options do anything.


I'm afraid i'm not too fluent in javascript or forms, and my friend Google is leading me nowhere so i could use a little fish or literal direction here. wacko.gif

Thanks,
jim
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 2 2006, 03:51 PM
Post #3


.
********

Group: WDG Moderators
Posts: 9,661
Joined: 10-August 06
Member No.: 7



QUOTE(jimlongo @ Oct 2 2006, 09:53 PM) *

I got that TARGET is a no-no, so that's why i'm trying to inject some javascript in the form. But I can't seem to get it to work, I've tried onclick in the submit section
CODE

<input type=submit name=btnG VALUE="Google Search" onclick="java script:openWin('http://www.google.com/search'); return false">


and onsubmit
CODE

<input type=submit name=btnG VALUE="Google Search" onsubmit="java script:openWin('http://www.google.com/search'); return false">



You need the query string with the search terms after the URL. I tried to find out how to get that from the form page onsubmit, but couldn't find anything, so I guess you'll have to let the script add the form field name/value pairs one by one before submitting.

QUOTE

and I've tried it in the action line in place of target="_blank" as well but none of those options do anything.


This appears to work:

CODE
<form action="..." onsubmit="this.target='_blank';">
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 03:00 PM