Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send this 'section' to a friend, instead of send this site

Status
Not open for further replies.

officemanager2

Technical User
Oct 11, 2007
116
CA
Hello: Very new to Java. Got this off the net

Code:
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! [URL unfurl="true"]http://javascript.internet.com[/URL] -->
<!-- Original:  David Henry (davidputhenry@yahoo.com) -->
<!-- Web Site:  [URL unfurl="true"]http://www.davidphenry.com[/URL] -->
<SCRIPT TYPE="text/javascript"><!--

var SubjectLine='Take a look at this web page I found, '+top.document.title; 
var BodyText='You can see this page at: '+top.location.href;

var Message='Send <A CLASS=contact HREF="mailto:?SUBJECT='+escape(SubjectLine)+'&BODY='+escape(BodyText)+'" OnMouseOver="status=\'Envoyer cette page à vos amis\'; return true;" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend.';

var MessageIE='Send <A CLASS=contact HREF="mailto:?SUBJECT='+(SubjectLine)+'&BODY='+(BodyText)+'" OnMouseOver="status=\'Envoyer cette page à vos amis\'; return true;" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend.';

if(document.all) { document.write(MessageIE); }

else { document.write(Message); }

//--></SCRIPT>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="[URL unfurl="true"]http://javascriptsource.com">The[/URL] JavaScript Source</a></font>
</center><p>

<!-- Script Size:  1.33 KB -->

What I'm trying to do is send a specific bit of the site, usually a paragraph from one of the pages, as opposed to the entire site.

Any suggestions would be appreciated.

thanks
 
I wonder how do you determine which portion of the page you want to send?

Have you consider placing an email icon/link within the layer itself so that upon selection, you pass the ID of clicked layer thus having the ability to extract its content and placing it on the body?



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
The viewer would see the page as such:

Heading One

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.

Send this paragraph

Heading Two

Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.

Send this paragraph

Heading Three

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat

Send this paragraph

If the viewer likes what they see in the Heading Two paragraph they can click on “Send this paragraph” and an email would load that would have the paragraph in the body, and subject line with the “Heading 2” there.

The end user would then have to insert the To line, as well as the CC, and BCC line. I hope this is clear.
 
If that is the case, you should be able to do something like this:
Code:
 function YOUR_FUNCTION_NAME(id) {
 var mail_string = document.getElementById(id).innerHTML;
  ....
  ....
  ....
 }
The HTML link should have something like
Code:
<div id="DIV_ID">
<span id="LAYER_ID">
 This is the content of the layer ...
</span>
<a href="javascript: YOUR_FUNCTION_NAME('LAYER_ID');">Send this paragraph</a>
</div>

You should then place mail_string where the body should be. Notice that I am assuming the the link is within the layer but you do not want to email the link itself so, I am using <span> to separate the target content from the anchor and passing the <span> tag ID (LAYER_ID) in lieu of the <div> tab ID.

I think this should get the job done ...



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
I've attempting to put this together, but still something is incorrect:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 <script>function sendpara(id) {
 var mail_string = document.getElementById(id).innerHTML;
  ....
  ....
  ....
 }
 </script>
</head>

<body>

 <table width="70%" border="2" align="center" cellpadding="2" cellspacing="5">
<tr>
		 
		  <td id="para1"><p>At vero eos et accusamus et iusto odio dignissimos 
        ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti 
        quos dolores et quas molestias excepturi sint occaecati cupiditate non 
        provident, similique sunt in culpa qui officia deserunt mollitia animi, 
        id est laborum et dolorum fuga. </p>
		
<div id="sendpara">
<span id="para1">
<a href="javascript: sendpara('para1');mailto:officemanager@segoresrouces.com?subject=paragraph 1">Send paragraph 1</a></span>
</div>
</td></tr>
		
		
        <tr>
		<td id="para2"><p>At vero eos et accusamus et iusto odio dignissimos ducimus qui 
        blanditiis praesentium voluptatum deleniti atque corrupti quos dolores 
        et quas molestias excepturi sint occaecati cupiditate non provident, similique 
        sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum 
        fuga. At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis 
        praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias 
        excepturi sint occaecati cupiditate non provident, similique sunt in culpa 
        qui officia deserunt mollitia animi, id est laborum et dolorum fuga. At 
        vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis 
        praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias 
        excepturi sint occaecati cupiditate non provident, similique sunt in culpa 
        qui officia deserunt mollitia animi, id est laborum et dolorum fuga. At 
        vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis 
        praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias 
        excepturi sint occaecati cupiditate non provident, similique sunt in culpa 
        qui officia deserunt mollitia animi, id est laborum et dolorum fuga. </p>
	


<div id="sendpara">
<span id="para2">
<a href="javascript: sendpara('para2');mailto:officemanager@segoresources.com?subject=paragraph2">Send paragraph 2</a></span>
</div>
</tr></td>				  

</table>

</body>
</html>

I believe how I have the a href line set up is the problem, but I cannot figure out how to correct this. Of course there could be other issues as well.
 
I've also tried working with this will limited success
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="autoEmailLink.js"></script>

</head>

<body>
<div id="parr">
<span id="part">
<tr>
<td id="par"><p>
       cusamus et iusto odio dignissimos ducimus qui blanditiis praesentium 
          voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi 
          quos dolores et quas molestias excepturi sint occaecati cupiditate non 
          provident, similique sunt in culpa qui officia deserunt mollitia animi, 
          id est laborum et dolorum fuga. </p>

</td></tr>

<tr><td><form name="eMailer">
      <input name="Button" type="button"  onClick="mailThisUrl();" value="E-mail this page">
      <input type="text" name="address" size="15">

</form></td></tr>
</body>
</html>

With this I'm able (or the end user) is able to type in an email but what is loaded into the body of the email is a link to the overall site, not the specific paragraph I am trying to send. I'm wondering if I cannot change the onclick from a URL to table data? or perhaps a table row?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top