PDA

View Full Version : onclick and email?



Crash1hd
Dec 4th, 2003, 11:09 AM
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!

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

Crash1hd
Dec 4th, 2003, 11:36 AM
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?

glenngv
Dec 4th, 2003, 11:39 AM
"");return false'>Please

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

glenngv
Dec 4th, 2003, 11:49 AM
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:

Crash1hd
Dec 4th, 2003, 11:56 AM
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?

glenngv
Dec 4th, 2003, 12: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.

Crash1hd
Dec 4th, 2003, 12: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

Crash1hd
Dec 4th, 2003, 12: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

<HTML>


<head>
<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")
self.close()
}
//-->
</script>
</head>

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

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

glenngv
Dec 4th, 2003, 12: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

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

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

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

Crash1hd
Dec 4th, 2003, 12: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:

glenngv
Dec 4th, 2003, 12: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)">

Crash1hd
Dec 4th, 2003, 12: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!