GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 29-Nov-2004, 14:49
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about

Javascript Auto Loads Href on Pageload


I am trying to find a way to use Javascript to have a mailto link open once the page is loaded.

This will be used for a banner system that when the banner is clicked, it automatically opens a new e-mail message to send the person who owns the banner ad.

If there is a better way to do this without javascript, let me know. 8-)
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #2  
Old 30-Nov-2004, 05:24
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Unless I have completely misunderstood your message, this is quite an unusual request. I have never seen such a thing; where I click a banner and it opens up my email client. Such a thing would make me quite nervous, to put it mildly.

On the other hand if you want (the web page) to "silently" send an email everytime there is a click on a banner, this is possible with a server-side script. For example, everytime you click on a listing at www.gidwebhosts.com/list-xml/, I have set it up so that I get an email with all the details of the click!
  #3  
Old 30-Nov-2004, 08:59
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
Not exactly.

Basically, users will know that in order to send the banner advertiser an e-mail, they must click on the banner ad.

Instead of configuring something on the server to handle this, it will be handled by the client. The easiest way to do this I thought would be a javascript to load a mailto link (which should open up someone's default browser).

I am not aware of any javascript that can do that, nor know if it can ever be done/work.

The banner link is on another page, so when someone clicks on it, we could place the javascript inside of that page.

It is pretty unusual & it would be interesting to see if something like this can be done.
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #4  
Old 30-Nov-2004, 16:56
JasonMichael's Avatar
JasonMichael JasonMichael is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 135
JasonMichael has a spectacular aura about
Here's a short javascript function that might work:

HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript" type="text/javascript"> function myJavascriptMailto( email) { var h; h = 'mailto:?to=' + email; location.replace(h); } </script> </head> <body> <a onclick="javscript:myJavascriptMailto('superman@jmrtechnet.com');return true;">Click me</a> </body> </html>
  #5  
Old 30-Nov-2004, 17:49
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
Not quite there... That is basically just using a regular email link. What I want to do is to have it automatically click that link, once the page opens.

So basically a body onload(openEmailFunction)

Where openEmailFunction is code that automatically "clicks" a mailto link.
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #6  
Old 21-Dec-2004, 18:52
erniegerdie erniegerdie is offline
Awaiting Email Confirmation
 
Join Date: Feb 2004
Location: England
Posts: 93
erniegerdie has a spectacular aura abouterniegerdie has a spectacular aura about
I can't quite understand what was wrong with the last code, except for changing:

HTML Code:
h = 'mailto:?to=' + email; -> h = 'mailto:' + email;

and instead of using the 'onclick' on the link tag, use the 'onload' on the body tag to launch the mailto link.

Or you could use the following approach:


HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript" type="text/javascript"> function sendmail() { document.mailForm.submit(); } </script> </head> <body onload = "sendmail()"> <FORM NAME="mailForm" ACTION="mailto:superman@jmrtechnet.com?subject=flying high" METHOD="get" ENCTYPE="multipart/form-data"> Go email go... </body> </html>

Make sure the form "METHOD" is a GET, as if it is a POST it will send the email automatically for the user.

Or maybe I've missed the point.
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
We're looking for JavaScript codes / mini tutorials. JdS Web Design Forum 8 23-Nov-2008 04:27
An Introduction to Javascript JasonMichael Web Design Forum 2 24-Oct-2004 11:19
JavaScript Tutorial Part 1 pcxgamer Web Design Forum 2 01-Dec-2003 10:16

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:07.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.