본문 바로가기

javascript

선택한 이메일 주소가 하이라이트 됩니다

 각각 다른 사이트에서 하나의 Contact Us 페이지를 운영할때
 
 
선택한 이메일 주소가 하이라이트 됩니다
contact.html 파일을 email.html 파일로 하이퍼 링크하여 사용합니다


<!--원문 설명서-->

If you would like to have several sites sharing one 'contact us' page, you can! Each site can link to the same page (but each with a unique string) and the appropriate site's information will be highlighted yellow in the contact table. For example, If they clicked on the 'contact us' link on the real estate page, the table cell with the real estate contact email address will be highlighted yellow instead of white on the contact us page. Clever!

<!--email.html-->

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
string = "" + location.search;
string = string.substring(1,string.length);
person1 = string.indexOf("person1"); // unique person1 string
person2 = string.indexOf("person2"); // unique person2 string
person3 = string.indexOf("person3"); // unique person3 string

text = "<center><table border=1 cellpadding=3 cellspacing=3>n";
text += "<tr><td colspan=2 align=center><b>Contact Us!</b></td></tr>n";

text += "<tr><td";
text += (person1>-1 ? " bgcolor=yellow>" : ">"); // highlights cell if location has ?person1
text += "Person 1: </td>n";
text += "<td align=center";
text += (person1>-1 ? " bgcolor=yellow>" : ">"); // highlights cell if location has ?person1
text += "<a href='mailto:person1@site.com'><b>person1@site.com</b></a></td>n";
text += "</tr>";

text += "<tr><td";
text += (person2>-1 ? " bgcolor=yellow>" : ">"); // highlights cell if location has ?person2
text += "Person 2: </td>n";
text += "<td align=center";
text += (person2>-1 ? " bgcolor=yellow>" : ">"); // highlights cell if location has ?person2
text += "<a href='mailto:person2@site.com'><b>person2@site.com</b></a></td>n";
text += "</tr>";

text += "<tr><td";
text += (person3>-1 ? " bgcolor=yellow>" : ">"); // highlights cell if location has ?person3
text += "Person 3: </td>n";
text += "<td align=center";
text += (person3>-1 ? " bgcolor=yellow>" : ">"); // highlights cell if location has ?person3
text += "<a href='mailto:person3@site.com'><b>person3@site.com</b></a></td>n";
text += "</tr>";

text += "</table></center>";
document.write(text);
//  End -->
</script>

<!--contact.html--->

<a href=email.html?person1>Contact Us - 1</a><br>
<a href=email.html?person2>Contact Us - 2</a><br>
<a href=email.html?person3>Contact Us - 3</a><br>