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

2014年12月28日 星期日

javascript-iif delimiter

editMode=(<%=Input[i][152]%>)?'edit':'readonly';


delimiter 
_c0x2=_c0x2+(_c0x2?',':'')+_c0x1[i4];

s2=s2+(s2?'<BR><BR>':'')+_lookup('SALES_ORDER_PO_DESC.DESCRIPTION'+i2)

2014年12月4日 星期四

javascript-if

el=document.createElement('<'+tag+(type?' type='+type:'')+' name='+nme+' >');

var y = (x == 2 ? "yes" : "no");

2014年7月29日 星期二

javascript-parameter

function parseDate(input, format) {
  format = format || 'yyyy-mm-dd'; // default format
  var parts = input.match(/(\d+)/g),
      i = 0, fmt = {};
  // extract date-part indexes from the format
  format.replace(/(yyyy|dd|mm)/g, function(part) { fmt[part] = i++; });

  return new Date(parts[fmt['yyyy']], parts[fmt['mm']]-1, parts[fmt['dd']]);
}

2014年7月22日 星期二

javascript-dtos date to string

function dateCal(pDate, pDay){
var ms = pDate.getTime(); //換成毫秒數
ms =ms+ pDay*24*60*60*1000; //計算相差的毫秒數
return new Date(ms); //返回新的時間對象
}

function dtos(pDate,pFormat){
if (!pFormat) pFormat='yyyy-mm-dd';
yyyy=pDate.getFullYear();
mm=pDate.getMonth()+1;
mm='0'+mm;
mm=right(mm,2);
dd=pDate.getDate();
dd='0'+dd;
dd=right(dd,2);
result='';
if (pFormat=='yyyy-mm-dd'){result=yyyy+'-'+mm+'-'+dd;}
else if (pFormat=='yyyymmdd'){result=yyyy+mm+dd;}
return result;
}

javascript-right



function dateCal(pDate, pDay){
var ms = pDate.getTime(); //換成毫秒數
ms =ms+ pDay*24*60*60*1000; //計算相差的毫秒數
return new Date(ms); //返回新的時間對象
}

function dtos(pDate,pFormat){
if (!pFormat) pFormat='yyyy-mm-dd';
yyyy=pDate.getFullYear();
mm=pDate.getMonth()+1;
mm='0'+mm;
mm=right(mm,2);
dd=pDate.getDate();
dd='0'+dd;
dd=right(dd,2);
result='';
if (pFormat=='yyyy-mm-dd'){result=yyyy+'-'+mm+'-'+dd;}
else if (pFormat=='yyyymmdd'){result=yyyy+mm+dd;}
return result;
}

2014年7月16日 星期三

javascript-scroll dom-scroll

window.scrollTo(0,0);
window.location.hash="#top_";
window.location.href="#top_"; //ok
top.scrollTo( 0, 0 );
top.location.hash = 'top_';
document.body.scrollTop = 0;
document.body.scrollLeft = 0;

2014年5月27日 星期二

dialog property properties

function xxfnOpenNormalDialog() {
if (hadEdit==1){
    $("#dialog-confirm").html("Are you sure ?");
    $("#dialog-confirm").dialog({
modal: true,
minHeight: 200,
minWidth: 300,
dialogClass: "no-close",
center: true,
my: "center",
at: "center",
of: window,
autoOpen:true,
resizable: false,
modal: true,
title: "Exit",
dialogClass: 'dlgfixed',
position: ['center','middle'],
      buttons: {
            "Yes": function () {
                $(this).dialog('close');
                callback(true);
            },
                "No": function () {
                $(this).dialog('close');
                callback(false);
            }
        }
    }).css("font-size", "15px") ;
}else{
parent.exitMoralBox();
}
}

2014年4月29日 星期二

javascript-indexof

Example

Search an array for the item "Apple":
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var a = fruits.indexOf("Apple");
The result of a will be:
2
Meaning that "Apple" is located at position 2 in the array.

2014年3月18日 星期二

javascript-jsp javascript-asp jquery-jsp jquery-asp

javascript-jsp
javascript-asp
jquery-jsp
jquery-asp


$.getJSON('getDate?callback=?',
function(data) {
if (data[0]){
for (r=0 ; r<data.length; r++)
{
//alert(data[0][0]);
//obj_field.options[r+1] = new Option(data[r][0],data[r][1]);
}
}
}
)







There are multiple possibilities in invoking a JSP page from JavaScript.

1) Opening the JSP page in a separate popup window using JavaScript function - window.open()
window.open("MyPage.jsp?param1=value1&param2=value2","pageName","height=400,width=400");
2) Redirecting to the JSP page when the form is submitted.
document.forms[0].action = "MyPage.jsp";
document.forms[0].method = "post"; // "get"
document.forms[0].submit();
3) Clicking on a hyperlink which will redirect to another page.
<a href="MyPage.jsp?param1=value1&param2=value2">My Page</a>

javascript-iframe-call-parent-click

in the parent window:
  1. <script>
  2. function OnFrameButtonClick () {
  3. alert ("You clicked on a button in the frame");
  4. }
  5. </script>
in the child frame window:
  1. <head>
  2. <script>
  3. function OnButtonClick () {
  4. // check whether the parent window and the OnFrameButtonClick method exist
  5. if (window.parent && parent.OnFrameButtonClick) {
  6. parent.OnFrameButtonClick ();
  7. }
  8. }
  9. </script>
  10. </head>
  11. <body>
  12. <button onclick="OnButtonClick ()">Test</button>
  13. </body>
You can find further examples on the following sites:

2014年2月22日 星期六

javascript-macro

<script language=javascript runat=server> 
one = 1; 
var1 = "one";   // in javascript you cannot use var as a variable 
response.write (one);            // will print 1 
response.write (var1);            // will print one 
response.write (eval(var1));    // will print 1 
</script> 

2014年2月10日 星期一

javascript-ext file name extension file name

var re = /(?:\.([^.]+))?$/;

var ext = re.exec("file.name.with.dots.txt")[1];   // "txt"
var ext = re.exec("file.txt")[1];                  // "txt"
var ext = re.exec("file")[1];                      // undefined
var ext = re.exec("")[1];                          // undefined
var ext = re.exec(null)[1];                        // undefined

2013年12月11日 星期三

javascript-datetimer-unique


it is generate from time

c=milliseconds = new Date().getTime(); //generate datetimer for master generate.datetimer


2013年12月6日 星期五

udf-_refresh




<input class="thisButton" type="button" class="button" style="float:left;" value="Logon"
onclick="_refresh('tag',1234)";>
<span id="tag">html</span>


function _refresh(v_id,v_value,v_enable){if (document.getElementById(v_id)){document.getElementById(v_id).innerHTML=v_value;}}

2013年12月4日 星期三

jquery-option select ADD and REMOVE

javascript-combo
javascript-select-option


$( "#password" ).blur(function() {
s0=_lookup('username');
s1=_lookup('password');
s='tableRead?db=hr&table=USER&fields=COMPANY_NAME&where=where '+
'login_id:`'+s0+'` and password:sha(`'+s1+'`) &format=S&callback=?';
$.getJSON(s,
 function(data) {
 if (data[0]){
$("#companyname").removeAttr("disabled");
$('#companyname').find('option').remove().end()  //combo clear combo-clear 
for (r=0; r<data.length; r++){
var o = new Option(data[r][0],data[r][0] );
$(o).html(data[r][0]);
$("#companyname").append(o);
}
  }  else {
$('#companyname').find('option').remove().end().append('<option value=""></option>').val('');
$("#companyname").attr( "disabled", "disabled" );
  }
 }
);
});



jquery-disable jquery-enable password verify

$("#pgdnButton,#pgupButton").removeAttr('disabled');
if(reccount*1<=limit*1) $("#pgdnButton,#pgupButton").each(function() {this.disabled='disabled';});



/*****************************************************************/

javascript-enable
jquery disable
jquery enable


$( "#password" ).blur(function() {
s0=_lookup('username');
s1=_lookup('password');
s='tableRead?db=hr&table=USER&fields=COMPANY_NAME&where=where '+
'login_id:`'+s0+'` and password:sha(`'+s1+'`) &format=S&callback=?';
$.getJSON(s,
 function(data) {
 if (data[0]){
$("#companyname").removeAttr("disabled");
  }  else {
$("#companyname").attr( "disabled", "disabled" );
  }
 }
);
});

2013年12月1日 星期日

javascript-modal subform

javascript-call-subform.

Step
  1. <link href="css/modalPopLite.css" rel="stylesheet" type="text/css" />
  2. <script src="js/modalPopLite.js" type="text/javascript"></script>
  3. <div id="clicker"></div>
    <div id="popup-wrapper"> <!--modal box-->
    <iframe width="100%" height="100%"
    name="moralFrame" id="moralFrame"
    src="#"
    frameborder="0" >
    </iframe>
    <a href="#" id="close-btn" style="display:none;">Close</a>
    </div>
  4. <script>
    $(function () {
    $('#popup-wrapper').modalPopLite({ openButton: '#clicker', closeButton: '#close-btn', isModal: true });
    });
    function exitMoralBox(string){
    $('#close-btn').click(); }
    </script>
  5. onclick="$('#popup-wrapper').width(1080).height(600);
    s1='';
    s='input9.jsp?input=companyProfileInput.txt&config=companyProfileInputConfig.txt&mode=DUMMY'; $('#moralFrame').prop('src', s);
    $('#clicker').click(); "

2013年11月26日 星期二

javascript-messagebox-dialog-box


jquery


<div id="dialog" title="Messagebox">
  <p>...</p>
</div>
<script>
  $(function() {
$( "#dialog" ).dialog({ autoOpen: false });
  });
</script>


s=_lookup("oldPassword");

s0='<%=bean.getPassword().trim()%>';
if (s != s0){
$("#dialog").dialog( "open" );
$("#dialog").dialog('option', 'title', 'Password Message');
$("#dialog p").html(" Old password not Match");
return false;
}
s1=_lookup("newPassword").trim();
s2=_lookup("confirmPassword").trim();
s3=<%=bean.getRecordid().trim()%>;

2013年11月18日 星期一

javascript-servlet javascript-call-servlet




{onchange}
var is_banked=(this.checked?1:0);
var s160610="tableWrite?"+
"db="+DATABASE+"&"+
"table=PCARD_HEADER&"+
"fields=IS_BANKED&"+
"values='"+is_banked+"'"
+"&key=recordID&value="+Xdata[thisRowNo]+
"&callback=?";
$.getJSON(s160610);
{/onchange}

******************************************************


javascript-call-servlet


$.get('http://192.168.10.80:8080/hr/ServletName?Parameter1=64&Parameter2=2013&Parameter3=8', function(data) {});

s= "tableWrite?"+
"table=employee&"+
"fields=password&"+
"values='"+s1+"'"+
"&key=recordID&value="+s3+
"&callback=?";
$.getJSON(s,
function(data) {
if (data[0]){
}  else {
}
}
); //endofgetJson