We help IT Professionals succeed at work.

How do I put an href button to open a site in an email without using javascript?

anAppBuilder
anAppBuilder asked
on
232 Views
Last Modified: 2010-04-21
Putting a line like
<a href='www.somesite.com' target='blank'>
in an HTML email will let the recipient click on the link to open the site in a new browser
.  
Is there a way to do this with a button, rather than the link, without using javasrcript?

Also, is there a way to specify a new tab, rather than a new browser (without using javacript)?
Comment
Watch Question

You could use:

<form name="form1" method="post" action="http://www.examplexkxkxkxkxk11.com" target="_blank"><input type="submit" name="Submit" value="Click me"></form>

or



-- With the 2nd example, ensure the image has been uploaded to a public webspace and thaty you're not using a local file.
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you, focusmultimedia.  I tried the first one and it works except that the button is hanging down below the text in onther s in the same .  I tried adding valign='top' to the button, but that doesn't help.  Any ideas?
Devario JohnsonPrincipal Software Engineer
CERTIFIED EXPERT

Commented:

<div style="vertical-align:top">
<form name="form1" method="post" action="http://www.examplexkxkxkxkxk11.com" target="_blank"><input type="submit" name="Submit" value="Click me"></form>
</div>

Open in new window

Author

Commented:
That didn't work either.  Let me do a few experiments then if it's stil not working I'll post a snippet.

Author

Commented:
Well I can't seem to make it align with the text.  Here's my php snippet .
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<?php
 
 	$site = "http://www.google.com";
 	$test = "<table><tr>
				<td align='left'>Some text</td>
				<td align='left'>&nbsp;Some more text&nbsp;</td>
				<td >&nbsp;&nbsp;
					<div style='vertical-align:top'>
						<form name='form1' method='get' action='$site' target='_blank'>
							<input type='submit' name='submit' value='Click Me'>
						</form>
					</div>
				</td>
			</tr></table>";
 	
 	print $test;
?>

Open in new window

Author

Commented:
and the page source
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<table><tr>
				<td align='left'>Some text</td>
				<td align='left'>&nbsp;Some more text&nbsp;</td>
				<td >&nbsp;&nbsp;
					<div style='vertical-align:top'>
						<form name='form1' method='get' action='http://www.google.com' target='_blank'>
							<input type='submit' name='submit' value='Click Me'>
						</form>
					</div>
				</td>
			</tr></table>

Open in new window

Author

Commented:
The vertical positioning of the button is really a separate problem, so I'm going to close this question with thanks to focusmultimedia. I've opened a separate question for the vertical positioning problem.

Author

Commented:
Thanks!

Author

Commented:
Thank you, devarioj for the vertical positiong suggestion.  PHope you'll give further suggestions for points in answer to the separate question I posted.
Devario JohnsonPrincipal Software Engineer
CERTIFIED EXPERT

Commented:
link me to your other question

Author

Commented:
Here's the link, but the question has already been answered.  Thanks anyway.

https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/HTML/Q_23567106.html
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.