?
Solved

on window open set focus on it

Posted on 2006-06-27
13
Medium Priority
?
619 Views
Last Modified: 2008-01-16
<A  class="bookmarklet" HREF="javascript:void(myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');myRef.focus();)">
<b>anything</b></A>
i have added myRef.focus(); but this link is not workin my requirement is to drag this link to firfox tool bar and focus on this window plz check the error in upper link i have provided to u
and please solve it.
0
Comment
Question by:naeembhatti
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +1
13 Comments
 
LVL 30

Expert Comment

by:third
ID: 16990810
try this,

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Author: Third Santor</title>
<script>
  function openWin(url){
    var myRef = window.open(url, 'Bookmarklet', 'menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');
    myRef.focus();
  }
</script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">

<A  class="bookmarklet" HREF="#" onclick="openWin('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href));return false;">
<b>anything</b></A>
</body>
</html>

i moved the script to a function to make the code more readable.
0
 

Author Comment

by:naeembhatti
ID: 16990827
no i said that i am using this link as a bookmarklet so i need it in herf=""
please give me solution in it .
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16990851
HREF="javascript:void(myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar,status,scrollbars,,resizable,width=530,left=200').focus())">
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:naeembhatti
ID: 16990873
yes this is right but please test it in firefox having drag it on its tool bar
it is not focusing on the pop up window which we opened.
focus is not working ? on herf on firefox?
0
 
LVL 30

Expert Comment

by:callrs
ID: 16990907
<A  class="bookmarklet" HREF="javascript:(function(){myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');myRef.focus();})()">
<b>anything</b></A>
0
 

Author Comment

by:naeembhatti
ID: 16990933
hi callrs it is not focusing on firefox ?
just make a page and paste ur code in it and drag it "anything" hyperlink to ur toolbar of firefox but it is not focusing on it?
0
 
LVL 30

Expert Comment

by:callrs
ID: 16990949
You're right. Window opens but loses focus..
0
 

Author Comment

by:naeembhatti
ID: 16990963
ok now please give me a solution this is my problem callrs.
0
 
LVL 30

Accepted Solution

by:
callrs earned 400 total points
ID: 16990971
<A  class="bookmarklet" HREF="javascript:(function(){myRef = window.open('<?=MAIN_PATH?>bookmarklet/index.php?page='+escape(location.href), 'Bookmarklet','menubar=yes,status=yes,location=no,toolbar=no,scrollbars=yes,width=530,resizable=yes,left=200');setTimeout('myRef.focus()',50);})()">
<b>anything</b></A>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16991002
The simple solution is to add a focus to the onLoad in your bookmarklet/index.php
0
 

Author Comment

by:naeembhatti
ID: 16991028
thanks to u all.
yes this is nice solution mplungjan but before loading of window i have 5 functions to run so it takes much time to load it thank u again.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16991243
<html>
<head>
<script>
window.focus()
.
.
.
</script>
0
 

Author Comment

by:naeembhatti
ID: 16998740
oh , right. yes it is true thank u mplungjan.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question