473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Open a window without focus

Can't get this to work, tried every bit of code I could think of and
every snippet I could find out there.

I have a form with the js code in the onsubmit action. I know, I
shoved it all in there instead of making a function. I don't have
access to include a .js file or put it in the head, work with me.

How can I get this to work?

<form method="get" action="#" onsubmit="var newWin =
window.open(\'http://google.com/search?q=\'+this.imdbSearch.value+\'\',
\'IMDBWindow\');window.setTimeout(\'self.focus();\ ',500);if(!
newWin.opener) newWin.opener=this;return false;">
<input type="text" name="imdbSearch" size="40">
<input type="submit" value="Search">
</form>
Feb 14 '08 #1
2 2181
Thu, 14 Feb 2008 09:50:11 -0800 (PST), /noon/:
How can I get this to work?

<form method="get" action="#" onsubmit="var newWin =
window.open(\'http://google.com/search?q=\'+this.imdbSearch.value+\'\',
\'IMDBWindow\');window.setTimeout(\'self.focus();\ ',500);if(!
newWin.opener) newWin.opener=this;return false;">
I'm not a JavaScript expert but 'this' in the above statement:

newWin.opener=this;

refers to the <formelement - not to the current window, if that's
what you want to put there.
<input type="text" name="imdbSearch" size="40">
<input type="submit" value="Search">
</form>
--
Stanimir
Feb 14 '08 #2
noon wrote:
Can't get this to work, tried every bit of code I could think of and
every snippet I could find out there.

I have a form with the js code in the onsubmit action. I know, I
shoved it all in there instead of making a function. I don't have
access to include a .js file or put it in the head, work with me.

How can I get this to work?

<form method="get" action="#" onsubmit="var newWin =
window.open(\'http://google.com/search?q=\'+this.imdbSearch.value+\'\',
\'IMDBWindow\');window.setTimeout(\'self.focus();\ ',500);if(!
newWin.opener) newWin.opener=this;return false;">
<input type="text" name="imdbSearch" size="40">
<input type="submit" value="Search">
</form>
I had the opposite problem. How to move focus relaibly TO the open window..

i used
newwin=window.open(....)
newwin.focus();

IIRC. Try using the above form and newwin.blur()

Or move focus to the parent.
Feb 14 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: ldan | last post by:
Hi everybody, I would not consider myself an expert in javascript - but so far whatever I know, helped me reaching my goals. Recently I started to experience a lot of javascript errors related...
4
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park...
6
by: Jack | last post by:
I have a main webpage that has a list of records, each with a link to a window.open function call. As an example, a page that opens is editrecord.aspx?RecordID=34, and another is...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
16
by: CreativeMind | last post by:
hi, i have a page calendar.aspx which returns selected date i.e window.returnValue=selectedDate; window.close(); it works fine with IE but not for Firefox. i tried...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.