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!

on going javascript issue

Status
Not open for further replies.

officemanager2

Technical User
Oct 11, 2007
116
CA
I've managed to put the follow together using posting boards and when loaded on a dreamweaver page it seems to work fine:

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">
</head>

<body>

<tr> 
          <td class="bookman" valign="top">
		  <p id="sst">test page</p><a name="light" id="light"></a>
          <td class="text">
		  <p align="justify" id="ss1">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. 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.</p>
          <p align="justify" id="ss2">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</p>
          <p align="justify" id="ss3">Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
			  </td>
        </tr>
<tr>
<td ><p align="left"> <a href="#">Top of page</a>
			</p></td>
				  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr><td>
<SCRIPT LANGUAGE="JavaScript">

<!-- 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@hotmail.com) -->
<!-- Web Site:  [URL unfurl="true"]http://www.davidphenry.com/[/URL] -->

<!-- Begin
function isPPC() {
if (navigator.appVersion.indexOf("PPC") != -1) return true;
else return false;
}
if(isPPC()) {
document.write('<b>Send <A CLASS="contact" HREF=\"mailto:\?subject\= ' + document.getElementById('sst').innerHTML + document.getElementById('ss1').innerHTML + document.getElementById('ss2').innerHTML + document.getElementById('ss3').innerHTML + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send this section to a freind">this section<\/A> to a friend</b>');
}
else { document.write('<b>Send <A CLASS="contact" HREF=\"mailto:?subject=Trying to load paragraphs from page to email\&body\= ' + "%0A" + document.getElementById('sst').innerHTML + "%0A" + "%0A" + document.getElementById('ss1').innerHTML + "%0A" + document.getElementById('ss2').innerHTML + "%0A" + document.getElementById('ss3').innerHTML + "%0A" + "To view the entire site use the link below" + "%0A" + "%0A" + "[URL unfurl="true"]http://www.somesite.ca"[/URL] +'\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send this section to a freind">this section<\/A> to a friend</b>');
}
//  End -->
</script>


</body>
</html>

In this version everything works fine. Click 'send this..' and it does everything as anticipated. The problem is when I use this same code (changing the ID for different sections) on a site the last paragraph will not work. Oddly enough if the section has four paragraphs the first three will work, but not the forth. Same issue with five paragraphs. To add to the headache, if there are four paragraphs I can only link to three of them because adding the fourth ID causes the link to disappear all together.

If the section only has two paragraphs this does not seem to be an issue. Is this tied into !=-1 ??

I've just started with javascript about two weeks ago so lots of mystery's.
 
The script part refers to only sst, ss1, ss2 and ss3. How can one expect more paragraphs? Besides, why is td unbalanced... and no table to start with to contains tr, td... You shouldn't expect a lot for the page to work.
 
I can put it all in a table if you wish, but my issue is not with the table or the HTML. The missing line is an issue, but as I said when there is the fourth ID the script won't show up on the screen. Don't know why?
 
>I can put it all in a table if you wish
It is not if I wish, but if you want keep your career or make a career.

>but as I said when there is the fourth ID the script won't show up on the screen. Don't know why?
But as I said [tt]"The script part refers to only sst, ss1, ss2 and ss3. How can one expect more paragraphs?"[/tt]
 
I hope what I've done here is clear

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">
</head>

<body>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<table>
<tr>
          <td class="bookman" valign="top">
          <p id="sst">test page</p><a name="light" id="light"></a></td>
          <td class="text">
          <p align="justify" id="ss1">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. 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.</p>
          <p align="justify" id="ss2">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</p>
          <p align="justify" id="ss3">Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
          <p align="justify" id="ss4">Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>

              </td>
        </tr>
<tr>
<td ><p align="left"> <a href="#">Top of page</a>
            </p>
                  
</td>
<td>
<SCRIPT LANGUAGE="JavaScript">

<!-- 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@hotmail.com) -->
<!-- Web Site:  [URL unfurl="true"]http://www.davidphenry.com/[/URL] -->

<!-- Begin
function isPPC() {
if (navigator.appVersion.indexOf("PPC") != -1) return true;
else return false;
}
if(isPPC()) {
document.write('<b>Send <A CLASS="contact" HREF=\"mailto:\?subject\= ' + document.getElementById('sst').innerHTML + document.getElementById('ss1').innerHTML + document.getElementById('ss2').innerHTML + document.getElementById('ss3').innerHTML +  document.getElementById('ss4').innerHTML + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send this section to a freind">this section<\/A> to a friend</b>');
}
else { document.write('<b>Send <A CLASS="contact" HREF=\"mailto:?subject=Trying to load paragraphs from page to email\&body\= ' + "%0A" + document.getElementById('sst').innerHTML + "%0A" + "%0A" + document.getElementById('ss1').innerHTML + "%0A" + document.getElementById('ss2').innerHTML + "%0A" + document.getElementById('ss3').innerHTML + "%0A" + document.getElementById('ss4').innerHTML + "To view the entire site use the link below" + "%0A" + "%0A" + "[URL unfurl="true"]http://www.somesite.ca"[/URL] +'\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send this section to a freind">this section<\/A> to a friend</b>');
}
//  End -->
</script>

</td></tr>
</table>
</body>
</html>

The way it is here it does not work for me so long as the following line is present:

Code:
 document.getElementById('ss4')

but when this bit is removed the script works, accept it does not insert the fourth paragraph into the email. I realize if the line for the fourth ID it is not there it cannot insert the fourth Id, but when the fourth ID is present nothing happens when pressed the 'sent to friend' is clicked.
 
Concrete implementation of mailto: necessarily has some length limit on the url. That imposes physical limit on the body and hence it cannot be extended at will. If you want to test, diminish the length of each paragraph but adding more paragraphs. You would probably find the same truncation happens but with many more paragraphs than 3.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top