Wednesday, October 23, 2013

Let me make replaceAll in Javascript

There is no replaceAll in javascript

if you use replace

ex) var orgStr = "welcome to my blog to have a fun";
     orgStr = orgStr.replace('to', 'ha');
     console.log(orgStr);
     output = "welcome ha my blog to have a fun"

It mean only first String will be replaced but otheres not,

So this is good solution

var orgStr = "welcome to my blog to have a fun";
     orgStr = orgStr.split('to').join('ha');
     console.log(orgStr);
     output = "welcome ha my blog ha have a fun"


Thursday, October 17, 2013

Javascript get Max Width of element in childnode

this function will return that the max width of element from tag element to inner element 




var mainDiv = document.getElementById('mainDiv');
  contentWidth = document.getElementById('contentScroller').offsetWidth;
   var maxVal = getMax (mainDiv, contentWidth);


function getMax (tag, val){
  if(typeof tag.offsetWidth != "undefined"){
   if(val < tag.offsetWidth){
    val = tag.offsetWidth;
   }
  }
 
  if(tag.children.length>0){
   var i=0;
   for (i=0;i<tag.children.length;i++){
    var childVal = getMax(tag.children[i], val);
    if(val < childVal){
     val = childVal;
    } 
   }
  }
  return val;
 }

Monday, October 14, 2013

Search Tag in Iframe from out of Iframe

this is Just example


document.getElementById('main_iframe').onload = function(){

var frameHtml = document.getElementById("main_iframe").contentWindow.document.body.innerHTML;
if(frameHtml.indexOf("loginForm") != -1){
location.href = '/neo/m4/home/login.mvc';
}else{

}

};


<iframe src="" id="main_iframe" width="100%" height="100%" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe>

Call to Parent Function in Iframe

There are two ways call parent function in iframe

 parent.functionName

 or

 window.top.functionName

This is only in my opinion, I would prefer to use  window.top.functionName.

because parent is not working well in sometime.

Wednesday, October 9, 2013

DOMWindow.js this is kind of popup in html

you can try example from below site http://swip.codylindley.com/DOMWindowDemo.html#inlineContentExample7

Wednesday, September 11, 2013

Install Openfire with Mssql

 
GO to openfire Website
 
Download openfire for Windows OS
 
 
Select Language
 
Select Your DB Server
 

setting Dabase


 
Setting Profile

 

setting Admin Account

Finally You can login 
asdf

Tuesday, September 10, 2013

Query time Count

you can fine result millisecond

DECLARE @start_time DATETIME, @end_time DATETIME
SET @start_time = CURRENT_TIMESTAMP;


[your Query here]


SET @end_time = CURRENT_TIMESTAMP
SELECT DATEDIFF(ms, @start_time, @end_time),DATEDIFF(ms, @start_time, @end_time)/1000;