使用javascript寫了一款BPO行業文字生成器

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>CSG Lodi Certificate</title>

<!-- script type="text/javascript" src="top.js"  -->
<script type="text/javascript" >


function sureClick(){
	//var names=document.getElementsByName("checkboxs");
	document.getElementById("bottom").innerHTML="";
	/*
	for(var i=0;i<names.length;i++){
		if(names[i].checked){
			document.getElementById("bottom").innerHTML+=names[i].value+" ";
		}
	}
	//alert("ok");
	*/
	
	document.getElementById("bottom").innerHTML=build();
}
function clearClick(){
	document.getElementById("bottom").innerHTML="";
}

//Get the (uper) Description; Return a string
function getProjectDesc(){
	var wordTmp = document.getElementById("projectDesc").value;
	var wording = "Re: "+wordTmp;
	return wording;
}

//Get the property of the AI, single or multiple
function getAIWords(){
	//This a the wording from the textarea of additional insured.
	var AI = document.getElementById("AI_Area").value;
	
	//This a the final worlds about AI 
	var AI_IsAre;
	
	//If the AI is single
	if(document.getElementById("single").checked)
		{
			AI_IsAre = AI + " "+"is an additional insured"
		}
	//If the AI are multiple
	if(document.getElementById("multiple").checked)
		{
		    AI_IsAre = AI +" "+"are additional insureds"
		}
	
	var glAuto;
	
	//If the GL is checked
	if(document.getElementById("AI_GL").checked && !document.getElementById("AI_Auto").checked)
		{
			glAuto = " "+"as respects General Liability per attached endorsements";
		}
	//If the Auto is checked
	else if(!document.getElementById("AI_GL").checked && document.getElementById("AI_Auto").checked)
		{
			glAuto = " "+"as respects Automobile Liability per attached endorsements";
		}
	//if the Gl and Auto are both checked
	else if(document.getElementById("AI_GL").checked &&
			document.getElementById("AI_Auto").checked)
		{
			glAuto = " "+"as respects General Liability and Automobile Liability per" +
					" attached endorsements";
		}
	else glAuto = "";
	
	return AI_IsAre+glAuto+". ";
 }

//Get the coverage wording
function getCoverageWords(){
	//The worlds in coverage and aggregate
	var coverageAgg;
	//If only primary is checked.
	if(document.getElementById("primary").checked && !document.getElementById("aggregate").checked)
		{
			coverageAgg = "Coverage is primary. ";
		}
	//If only aggregate is checked.
	else if(!document.getElementById("primary").checked && document.getElementById("aggregate").checked)
		{
			coverageAgg = "Per project aggregate applies per attached endorsements. ";
		}
	//If only if primary and aggregate both checked
	else if(document.getElementById("primary").checked &&
			document.getElementById("aggregate").checked)
		{
			coverageAgg = "Coverage is primary, per project aggregate applies per"
				+" attached endorsements. "
		}
	//If only if neither primary nor aggregate are checked.
	else coverageAgg = " ";
	
	return coverageAgg;
	
}

function getWaiverWords(){
	
	var waiver;
	
	var glWaiverCheck = document.getElementById("glWaiver").checked;
	var autoWaiverCheck = document.getElementById("autoWaiver").checked;
	var wcWaiverChek = document.getElementById("wcWaiver").checked;
	
	if(glWaiverCheck  && !autoWaiverCheck && !wcWaiverChek)
		{
			waiver = "GL waiver of subrogation applies per attached endorsements.";
		}
	else if(!glWaiverCheck && autoWaiverCheck && !wcWaiverChek)
		{
			waiver = "Auto waiver of subrogation applies per attached endorsements.";
		}
	else if(!glWaiverCheck && !autoWaiverCheck && wcWaiverChek)
		{
			waiver = "WC waiver of subrogation applies per attached endorsements.";
		}
	else if(glWaiverCheck && autoWaiverCheck && !wcWaiverChek)
		{
			waiver = "Gl, Auto waiver of subrogation apply per attached endorsements.";
		}
	else if(glWaiverCheck && !autoWaiverCheck && wcWaiverChek)
		{
			waiver = "GL, WC waiver of subrogation apply per attached endorsements.";
		}
	else if(!glWaiverCheck && autoWaiverCheck && wcWaiverChek)
		{
			waiver = "Auto, WC waiver of subrogation apply per attached endorsements.";
		}
	else if(glWaiverCheck && autoWaiverCheck && wcWaiverChek)
		{
			waiver = "GL, Auto & WC waiver of subrogation apply per attached endorsements."
		}
	else waiver = "";
	return waiver;
}

function build(){
	var result;
	result = getProjectDesc() +"<br />"+
				getAIWords() + getCoverageWords() +getWaiverWords();
    return result;
}

function copyClick(){
	var result;
	result = getProjectDesc() +"               "+
				getAIWords() + getCoverageWords() +getWaiverWords();

	 window.clipboardData.setData('text',result);   
	 //alert("Copied to Clipboard.");
}


	
		
	

</script>

<style type="text/css">

.updiv{

                border: 1px solid;
				width: 848px;
				height: 60px;
				margin-bottom: 12px;
				padding-left: 10px;

}

.leftdiv{

               width: 397px;

               border: 1px solid;

               height: 279px;

               text-align: center;

}

.lefttable{

             

               padding: 11px;

               margin-left: 27px;

               margin-top: 19px;

               height: 213px;

              

}

.centerdiv{

               float:left;

               border: 1px solid;

               height: 255px;

               margin-left: 7px;

               padding: 12px;

               width: 121px;

}

.bottomdiv{

               border: 1px solid;

               width: 97%;

               height: 132px;

}

.fondSpecial{
				font-size: 17px;
				font-weight: bolder;
				font-style: italic;
}

</style>

</head>

<body style="width: 887px;margin: auto;">

  <div>

     <div style="text-align: center;"><h1>CSG LODI DAILY CERTIFICATE</h1></div>

     <div>

       <div class="updiv">
       <span>Re: Project #ID + Project Description + Location </span>
       
	       <div style="margin-top: 10px;margin-bottom: 4px;">
	       <div style="padding-right: 13px;font-weight: bold;font-style: italic;float: left;">Re:</div>
	       <textarea id="projectDesc" rows="2" cols="111" ></textarea>
	       </div>
       </div>

       <div style="float:left;" class="leftdiv">

       <br>

                <span style="font-size: 17px; font-weight: bolder; font-style: italic;">Additional Insured(s)</span>

       <table class="lefttable">

         <tr>

                <td>

                              <textarea id="AI_Area" rows="8" cols="30"></textarea>

                </td>

                <td>

                                              Single<input type="radio" id="single" name="AI_Pro" value="Single"> <br>

                                             Multiple<input type="radio" id="multiple" name="AI_Pro" value="Multiple">

               </td>

         </tr>

         <tr>

                          <td><b>General Liability</b><input type="checkbox" id="AI_GL" name="checkboxs" value="General Liability"><br>

                          <b>Automobile Liability</b><input type="checkbox" id="AI_Auto" value="Automobile Liability"></td>

                          <td></td>

         </tr>

       </table>

        </div>

       <div class="centerdiv">

                       <span class="fondSpecial">Primary</span>

                       <input type="checkbox" id="primary" name="checkboxs" value="Primary"/>

       </div>

       <div class="centerdiv">

        <span class="fondSpecial">Project</span> <br>

        <span class="fondSpecial">Aggregate</span>

        <input type="checkbox" id="aggregate" name="checkboxs" value="Project Aggregate"/>

       </div>

       <div class="centerdiv">

         <span class="fondSpecial">Waiver</span><br />

         GL<input type="checkbox" id="glWaiver" name="checkboxs" value="GL"/><br>

         AT<input type="checkbox" id="autoWaiver" name="checkboxs" value="AT"/><br>

         WC<input type="checkbox" id="wcWaiver" name="checkboxs" value="WC"/>

       </div>

     </div>

     <div style="clear: left;padding-top: 8px;">

      Words/Notes<br>

      <div class="bottomdiv" id="bottom"></div>

      <input type="button" value="sure" οnclick="sureClick()">

      <input type="reset" value="clear" οnclick="clearClick()">
      
      <input type="button" value="Copy" onClick="copyClick()">
      

     </div>

    

  </div>

</body>

</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章