Solved

on window open set focus on it

Posted on 2006-06-27
13
606 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trouble inserting a variable  in javascript 7 42
Javascript create file issue 4 45
Animated .jpg? 13 57
how can i remove string values 2 0
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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now