Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2007, 11:49 AM
Authorized User
 
Join Date: Oct 2006
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default Focus

I having a problem with my popup calendar. What I would like to do is focus on a particular textbox after a date is selected and right now it's not doing that. Does anyone have any idea how to do it? here's the code...


Dim popupScript As String = "<script language='javascript'>" & _
"window.open('calendar.aspx?formname=frmFireworksP e rmitApp.txtdisplaydate', 'calendar', " & _
"'width = 300, height = 200, menubar = no, resizable=yes, scroll=auto');my_window.focus()" & _
"</script>"

Private Sub btncal1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncal1.Click
Page.RegisterStartupScript("PopUPScript", popupScript)

End Sub


 
Old September 18th, 2007, 01:31 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Dhoward!!

You need to write script ,when user click on the particular date.


Cheers :)

vinod
 
Old September 18th, 2007, 09:50 AM
Authorized User
 
Join Date: Oct 2006
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I thought that's what I did. Could you give me an example?

 
Old September 19th, 2007, 02:54 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Dhoward!!

Since u r using aspx,just pass the form-name ,and the control name where you want to focus in calendar.aspx page.
this code is for only demo purpose.
Also in ur code
"window.open('calendar.aspx?formname=frmFireworksP e rmitApp.txtdisplaydate', 'calendar', " & _
--->formname=frmFireworksPe is ok,
---> rmitApp.txtdisplaydate ?? ,it should be separated by "&",( or u have placed spaces ) so that you can know where to set ur date value,also u need to pass where to focus after date is selected

********test.html*********

<script>

function CallMe()
{
window.open("calendar.html")
}
</script>
<form name="myform">
<input type=button onclick="CallMe()" value="win">
Date<input type=text readonly name=dtname>
FirstName<input type=text name=fname>

</form>


********Calendar.html*********
<script>

function CallMe(obj)
{
window.opener.myform.dtname.value=obj.value+"/12/2007";
window.opener.myform.fname.focus();
window.close();
}
</script>
 <input type=button onclick="CallMe(this)" value="12">


Hope this will help you

Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
Focus dhoward VB.NET 2002/2003 Basics 0 September 13th, 2007 02:23 PM
focus kvanchi General .NET 2 December 13th, 2004 09:16 PM
Focus pbyrum Javascript 2 September 3rd, 2004 04:48 PM
Focus jbenson001 ASP.NET 1.x and 2.0 Application Design 2 February 18th, 2004 02:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.