Javascript opens new window but changes main page

mlg101
mlg101 used Ask the Experts™
on
I have a simple javascript (attached to a hyperlink) which opens a new window, but on the main page where I click the link to open the new window it redirects to a page which just says, "[object]". I then have to hit the back button on the browser (IE8) to get back to the main page. How can I execute the javascript to open a new page without the main page jumping to "[object]" blank page?


Here is the javascript:
POSHyp.NavigateUrl = "javascript:window.open('PrintPOSDec2.aspx?Order=" + JobNumber.Text + "&Att1=" + Att1.Checked.ToString.ToLower() + "&Co1=" + Co1.Checked.ToString.ToLower() + "&Srv1=" + Srv1.Checked.ToString.ToLower() + "&LinkID=" + LinkID.Text + "&check=" + Check.Checked.ToString() + "')"

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
can't you just add a ";void(0);" after the window.open(...) command?
Don't know the object you are using ("POSHyp.NavigateUrl")
:

	

Here is the javascript:
POSHyp.NavigateUrl = "javascript:window.open('PrintPOSDec2.aspx?Order=" + JobNumber.Text + "&Att1=" + Att1.Checked.ToString.ToLower() + "&Co1=" + Co1.Checked.ToString.ToLower() + "&Srv1=" + Srv1.Checked.ToString.ToLower() + "&LinkID=" + LinkID.Text + "&check=" + Check.Checked.ToString() + "');void(0);"

Open in new window

Not sure what the navigateurl property is(or the object it is attached to), but you are better off adding the window.open call to the click event of the link if possible.

http://www.jibbering.com/faq/#javascriptURI

Author

Commented:
It's a .net hyperlink, so the navagateurl is a property of that

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial