顯示具有 JavaScript 標籤的文章。 顯示所有文章
顯示具有 JavaScript 標籤的文章。 顯示所有文章

2017年3月17日 星期五

How to create Date as input with Calendar in visualforce page

How to create Date as input with Calendar in visualforce page


-------- Vf page-------------
<apex:page controller="inputdate" >
<script>
function DynamicDatePicker(d_id)
{
    DatePicker.pickDate(false,d_id.id,false);
}
</script>
  <apex:form >

  <apex:inputText id="time" value="{!inputdate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="20" disabled="false" style="width:150px;"/>
  <apex:commandButton action="{!testdate}" value="Save" />
  </apex:form>

</apex:page>

--------------------- Apex Controller --------------------
public class inputdate
{
    public date inputdate{get;set;}


public void testdate()
{
    system.debug('@@@@@@@@@@@@@@'+inputdate);
}
}

2017年2月8日 星期三

使用JavaScript讀取檔案

    <html>
    <head>
    <script>
      var openFile = function(event) {
        var input = event.target;

        var reader = new FileReader();
        reader.onload = function(){
          var text = reader.result;
          var node = document.getElementById('output');
          node.innerText = text;
          console.log(reader.result.substring(0, 200));
        };
        reader.readAsText(input.files[0]);
      };
    </script>
    </head>
    <body>
    <input type='file' accept='text/plain' onchange='openFile(event)'><br>
    <div id='output'>
    ...
    </div>
    </body>
    </html>

參考網址:http://stackoverflow.com/questions/14446447/javascript-read-local-text-file

2015年12月24日 星期四

將Html Table匯出成Excel file


使用以下JavaScript

<script type="text/javascript">
function ExportToExcel(mytblId){
       var htmltable= document.getElementById('my-table-id');
       var html = htmltable.outerHTML;
       window.open('data:application/vnd.ms-excel,' + encodeURIComponent(html));
    }
</script>

參考網址:http://stackoverflow.com/questions/22317951/export-html-table-data-to-excel-using-javascript-jquery-is-not-working-properl