Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Javascript window.open event causes parent window to display [object]

Posted on 2009-02-11
8
Medium Priority
?
986 Views
Last Modified: 2012-05-06
Good evening,

I have the code section # 1 setting an onclick event for a ASP.NET calendar control in its render event.  The javascript runs fine.  But, upon opening the second window, the parent changes to a blank screen displaying the text "[object]".  I've attached an image of the page.  Does anyone know the solution to fix this?

Thank you in advance.
Section # 1:
e.Cell.Text = "<a href=javascript:window.open('http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & "','newwindow',width=825) style=color:#5195CE>" & e.Day.DayNumberText & "</a>"

Open in new window

Error1.JPG
0
Comment
Question by:divinewind80
  • 4
  • 2
  • 2
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 23617079
is the url of the loaded page as expected
check it in firefox with firebug to see the cause of the error

0
 
LVL 9

Author Comment

by:divinewind80
ID: 23617203
Yes, it appears correctly.  Just to be clear, the pop-up window is loading perfectly.  At the moment it loads, though, the parent page goes blank.

I will try out the Firefox with Firebug solution.

Let me know if anyone else has any ideas.

Thanks.
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 23617276
try:

<a href="#" onClick="javascript:....
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!

 
LVL 16

Expert Comment

by:sunithnair
ID: 23617314
Do any of the following and see if it works
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href="#" onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"

Open in new window

0
 
LVL 16

Expert Comment

by:sunithnair
ID: 23617329
sorry this
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href='#' onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style=color:#5195CE>" & e.Day.DayNumberText & "</a>"

Open in new window

0
 
LVL 16

Assisted Solution

by:sunithnair
sunithnair earned 1000 total points
ID: 23617418
Try to put style also in quotes
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href='#' onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825"")' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"

Open in new window

0
 
LVL 9

Author Comment

by:divinewind80
ID: 23617481
Seems like the "#" idea worked.  Thank you very much.  Any ideas what caused this to happen in the first place?
0
 
LVL 16

Expert Comment

by:sunithnair
ID: 23617506
You did not have the proper quotes opening and closing i suppose. You can also try adding a return false statement in the end like this
e.Cell.Text = "<a href='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825""); return false;' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"
 
or
 
e.Cell.Text = "<a href='#' onclick='javascript:window.open(""http://www.website.com/detail.aspx?locationid=" & ddl1.SelectedValue & "&datevar=" & e.Day.Date & """,""newwindow"",""width=825""); return false;' style='color:#5195CE'>" & e.Day.DayNumberText & "</a>"

Open in new window

0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Don’ts and Dos are two important end products of software testing basics that a tester needs to regard. This article attempts to explain the principles of both.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

571 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