View Full Version : onclick and email?

Dec 4th, 2003, 12:09 PM
I am useing the following code in my emails and seems to work in some email clients but doesnt work in outlook? is there anything that can be done to make it work in outlook?

<a href='@' onClick='window.open(""http://www.Alwaysremember.ca/Login/register.asp?emc=&#39;" & email & "&#39;&uid=" & userid & """, ""page"", ""status=yes, scrollbars=yes, width=800, height=600, left=20, top=20"")'>click here</a>

I was useing the @ instead of the # cause the email client that it works in opens a second file when # is used but doesnt when @ is used!

Dec 4th, 2003, 12:28 PM
put back the # and then put return false after calling window.open to cancel the href

Dec 4th, 2003, 12:36 PM
like so

MessageBody = MessageBody & "<b><a href='#' onClick='window.open(""http://www.Alwaysremember.ca/Login/register.asp?emc=&#39;" & email & "&#39;&uid=" & userid & """, ""page"", ""status=yes, scrollbars=yes, width=800, height=600, left=20, top=20"")' return false>Please click here to confirm</a></b>"

still doesnt work in outlook?

Dec 4th, 2003, 12:39 PM
"");return false'>Please

Dec 4th, 2003, 12:43 PM
ok changed that but it still doesnt open the link in outlook email?

Dec 4th, 2003, 12:49 PM
your window.open statement will open the specified page "register.asp" in a window named "page" so the page is opened in the browser not in an email client. are you really sure the page is opened in other mail clients? :confused:

Dec 4th, 2003, 12:56 PM
ok what I am trying to acheive is the window.open is in a link that is in an email and when I use incredimail and I get the email and click on the link it opens the window in a browser yet when I try to do the same useing outlook the same link doesnt open a browser window I can click it all I want and nothing happens?

Dec 4th, 2003, 01:05 PM
maybe javascript is disabled in outlook.
try this:

MessageBody = MessageBody & "<b><a href=""http://www.Alwaysremember.ca/Login/register.asp?emc=" & email & "&uid=" & userid & """ target=""page"" onClick=""window.open(this.href,this.target,'status=yes, scrollbars=yes, width=800, height=600, left=20, top=20');return false"">Please click here to confirm</a></b>"

even if javascript is disabled, the page will still be opened in a new window, though the address bar and menu bar are visible.

Dec 4th, 2003, 01:10 PM
yep that does open it and works however that would be no different the just useing a href='and putting the http: in here'

cause i loose control over the elements

Dec 4th, 2003, 01:13 PM
but seeing as how javascript is disabled in outlook I am going on a different approach where if the page is loaded and its not the size I want it to be it will close and open a new window example below


<script language="JavaScript" type="text/javascript">
function closewindow() {
self.opener = this;
window.open (window.location+"?show=1", "page", "status=yes, scrollbars=yes, width=800, height=600, left=20, top=20")

<%If request.querystring("show") = 1 Then%>
<body onload="closewindow()">
<%End If%>

the problem I am having is for some reason this works great until i intergrated it in my asp pages and now it loads both pages and closes both pages

Dec 4th, 2003, 01:15 PM
yes, that's how it should be. Don't you like it degrading well with other browsers?
the href part is for browsers or mail clients (in your case) with javascript disabled. the onclick part is for those with javascript

Dec 4th, 2003, 01:22 PM
try specifying a different target

window.open (window.location+"?show=1", "page2", ...

<%If request.querystring("show") = "1" Then%>

Dec 4th, 2003, 01:27 PM
Lol the problem was my browser was blocking popups! :)

So that is going to be a problem as there are a lot of people that dont like popups
so I guess anyone that views the site from outlook is going to see the page not they way I entended it to be! that sucks!:mad:

Dec 4th, 2003, 01:33 PM
If you're just concern about the size of the window and can do with visible menubars, you can resize the window onload.

<body onload="window.resizeTo(800,600)">

Dec 4th, 2003, 01:39 PM
NO I tried that the size of the window is different then it is without the bars at the top

I have it set to 800/600 with no menu bars ext.. so when you do the body onload setting it to 800/600 it actually opens at a different size I have it set up on the site when you click a link on the site it opens properly it was just to get it to open the same from email but the solution you gave me seems to be the best for that!