![]() |
|
#1
|
||||
|
||||
Javascript Auto Loads Href on PageloadI 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
|
||||
|
||||
|
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! __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
||||
|
||||
|
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
|
||||
|
||||
|
Here's a short javascript function that might work:
HTML Code:
|
|
#5
|
||||
|
||||
|
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
|
|||
|
|||
|
I can't quite understand what was wrong with the last code, except for changing:
HTML Code:
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:
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 GIDBlog
Halfway done! by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| We're looking for JavaScript codes / mini tutorials. | JdS | Web Design Forum | 7 | 31-Mar-2008 23:25 |
| An Introduction to Javascript | JasonMichael | Web Design Forum | 2 | 24-Oct-2004 10:19 |
| JavaScript Tutorial Part 1 | pcxgamer | Web Design Forum | 2 | 01-Dec-2003 09:16 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The