1 Reply Latest reply on Jul 22, 2014 11:00 PM by Ryan Rutan

    l laod iframe on one link in my page using jquery. It works fine in all browsers except IE10. Please help me out waht is problem.

    mahavarkar.dipika@gmail.com

      Tooltip.js

      var jqtoolTiphovering;

      jQuery.fn.toolTip = function () {

      var obj = $(this);

      var args = (arguments[0]) ? arguments[0] : { "mode": "help" };

      var successFn = arguments[1];

      var mode = (args.mode) ? args.mode : 'help';

      var lookup = (args.lookup) ? args.lookup : '';

      var url = (args.url) ? args.url : '';

      var wdtfactor = (args.size) ? args.size : 'medium';

      var disable = (args.disable) ? args.disable : 'false';

      var max = (args.MaxRecordsToFetch) ? args.MaxRecordsToFetch : 100;

      var pagesize = (args.pagesize) ? args.pagesize : 10;

      var objectToSet = (args.object) ? document.getElementById(args.object) : '';

      var oricondition = (args.condition) ? args.condition : '';

      var displayorder = (args.displayorder) ? args.displayorder : '';

      var allowstar = (args.allowstar) ? args.allowstar : false;

      if (displayorder != '') {

      displayorder = displayorder.split(',');

      }

      var displayorderlen = displayorder.length;

      var condition = '';

      //clear controls

      if (objectToSet) {

      if (objectToSet != '' && objectToSet != undefined) {

      objectToSet.controlarray = (args.controlarray) ? args.controlarray : '';

      objectToSet.oldvalue = objectToSet.value;

      if ($(objectToSet).hasClass('tooltipsearch') == false) {

      $(objectToSet).unbind('blur');

      $(objectToSet).bind('blur', function () {

      var that = this;

      if (that.value == '') {

      clearControls(that);

      } else {

      if (that.oldvalue != that.value && that.value.indexOf('%') < 0 && ((that.value != '*' && allowstar == true) || allowstar == false)) {

      generateCondition();

      Netxert.APP.Web.NetxertAPP.getDynamicHelp(lookup, 2, min, max, that.value, condition, function (args) {

      if (args != '[]') {

      if (successFn) {

      args = eval('(' + args + ')');

      successFn(args[0]);

      }

      } else {

      var rndtdid = 'td' + Math.ceil(Math.random() * 1000);

      if (that.parentNode.parentNode.parentNode.parentNode.parentNode) {

      that.parentNode.parentNode.parentNode.parentNode.parentNode.uniqueid = rndtdid;

      var pnode = that.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('TD');

      var msg = '';

      for (var k = 0; k < pnode.length; k++) {

      if (pnode[k + 1]) {

      if (pnode[k + 1].uniqueid == rndtdid) {

      msg = $(pnode[k]).find('span').filter(function () { return $(this).html() != '*'; }).first().html();

      break;

      }

      }

      }

       

      alert('Invalid data entered for ' + msg.replace(':', ''));

      clearControls(that);

      that.value = '';

      that.focus();

      return false;

      }

      }

      }, function (err) { if (err._message.indexOf('Authentication failed') >= 0) { window.location = '/SessionTimeOut.aspx'; } else { alert(err._message); } });

      }

      }

      });

      }

      }

      }

      function clearControls(obj) {

      if (obj.controlarray != '') {

      var arr = obj.controlarray.split(','); var arrlen = arr.length;

      while (arrlen--) {

      var currentobj = document.getElementById(arr[arrlen]);

      if (currentobj.nodeName.toLowerCase() === 'span' || currentobj.nodeName.toLowerCase() === 'div') {

      currentobj.innerHTML = '';

      } else if (currentobj.nodeName.toLowerCase() === 'input' || currentobj.nodeName.toLowerCase() === 'textarea') {

      currentobj.value = '';

      }

      }

      }

      }

      var canvas = document.getElementById("canv");

      var min = 1; var wdt, hgt;

      var crmin = min; var crmax = max;

      var totalrecords; var recordlength = 0;

      var searchterm = ''; var originx1 = 0; var originx2 = 10; var lft = 0;

      var rnd = Math.ceil(Math.random() * 1000);

      var startrec = 0; var endrec = pagesize - 1;

      var globalresultset; var size = '';

      if (typeof (wdtfactor) == 'string') {

      if (wdtfactor == 'small') {

      wdtfactor = 3;

      } else if (wdtfactor == 'medium') {

      wdtfactor = 2.1;

      } else if (wdtfactor == 'large') {

      wdtfactor = 1.5;

      } else if (wdtfactor == 'verylarge') {

      wdtfactor = 1.3;

      } else if (wdtfactor == 'full') {

      size = wdtfactor;

      wdtfactor = 1.05;

      }

      }

      if (wdtfactor > 3) {

      wdtfactor = 3;

      }

      //creating tooltip

      obj.unbind('click');

      obj.click(function () {

      crmin = min; crmax = max;

      searchterm = '';

      $('.helpinfocontrol,.helpinfocontrolclose,.helpinfocontrolmodal,.anim').remove();

      // if (disable == 'true') {

      // $('#DvFilterCell').css({'display':'none'});

      // $('#DvMainPanel').css({ 'width': '97%', 'marginLeft': '18px' });

      // $('#DvFilterToggle').css({ 'left': '0','backgroundPosition': '-819px -95px' });

      // }

      var ofs = $(this).offset();

      var factor = wdtfactor;

      wdt = Math.ceil($(window).width() / factor);

      hgt = Math.ceil($(window).height() / factor);

      var scrolltop = $(document).scrollTop();

      var tp = ofs.top - ((size == 'full') ? 40 : 20);

       

      if (ofs.left + 20 > wdt) {

      lft = ofs.left - wdt;

      originx2 = (wdt - 20) + 10;

      originx1 = originx2 + 10;

      } else {

      lft = ofs.left + 20;

      }

       

      dvanim = document.createElement('div');

      dvanim.id = "Dv_" + rnd;

      dvanim.className = "anim";

      dvanim.style.backgroundPosition = "0px 0px";

      dvanim.style.top = (tp + (hgt / 2) - 24) + 'px';

      dvanim.style.left = (lft + (wdt / 2) - 24) + 'px';

      document.body.appendChild(dvanim);

       

      if (mode === 'help') {

      var ifr = document.createElement('iframe');

      ifr.className = 'helpinfocontrol';

      ifr.frameBorder = 0;

      ifr.id = 'IFR_' + rnd;

      document.body.appendChild(ifr);

      ifr.anim = new LoadingAnimation("Dv_" + rnd);

      if (document.attachEvent) { //IE

      var that = ifr;

      ifr.attachEvent('onload', function () { that.anim.Stop(); });

      } else if (document.addEventListener) { //Firefox

      var that = ifr;

      ifr.addEventListener('load', function () { that.anim.Stop(); }, false);

      } else {

      ifr.onload = function () {

      this.anim.Stop();

      }

      }

      $(ifr).css({ width: wdt - 37, height: hgt - 37, left: lft + 20, top: tp + 15, 'position': 'absolute', 'z-index': 299998 });

      ifr.src = url;

      ifr.anim.Start();

      } else {

      var dvSearch = document.createElement('div');

      dvSearch.className = 'helpinfocontrol';

      document.body.appendChild(dvSearch);

      dvSearch.onmouseover = callHover;

      dvSearch.onmouseout = callOut;

      dvSearch.innerHTML = '<input type="text" id="txtSearch' + rnd + '" />';

      var btnSearch = document.createElement('input');

      btnSearch.type = 'button';

      btnSearch.value = 'Search';

      btnSearch.id = 'btnSearch' + rnd;

      dvSearch.appendChild(btnSearch);

      btnSearch.onclick = function () { if (objectToSet) { if (objectToSet != '' || objectToSet != undefined) { crmin = min; crmax = max; searchterm = document.getElementById('txtSearch' + rnd).value; buildDynamicHelp(dvResult); } else { dvResult.innerHTML = 'Input object not provided / found for search!!

       

      Please check id passed of the control!'; dvResult.anim.Stop(); } } else { dvResult.innerHTML = 'Input object not provided / found for search!!

       

      Please check control id passed!'; dvResult.anim.Stop(); } }

      var dvResult = document.createElement('div');

      dvResult.id = 'dvResult' + rnd;

      dvSearch.appendChild(dvResult);

      dvResult.anim = new LoadingAnimation("Dv_" + rnd);

      if (document.attachEvent) { //IE

      var that = dvResult;

      dvResult.attachEvent('onload', function () { that.anim.Stop(); });

      } else if (document.addEventListener) { //Firefox

      var that = dvResult;

      dvResult.addEventListener('load', function () { that.anim.Stop(); }, false);

      } else {

      dvResult.onload = function () {

      this.anim.Stop();

      }

      }

      $(dvSearch).css({ width: wdt - 37, height: hgt - 37, left: lft + 20, top: tp + 15, 'position': 'absolute', 'z-index': 299998 });

      dvResult.anim.Start();

      if (objectToSet) {

      if (objectToSet != '' || objectToSet != undefined) {

      if (objectToSet.value != '' && objectToSet.disabled == false) {

      searchterm = objectToSet.value;

      document.getElementById('txtSearch' + rnd).value = objectToSet.value;

      }

      buildDynamicHelp(dvResult);

      } else {

      dvResult.innerHTML = 'Input object not provided / found for search!!

       

      Please check id passed of the control!';

      dvResult.anim.Stop();

      }

      } else {

      dvResult.innerHTML = 'Input object not provided / found for search!!

       

      Please check id passed of the control!';

      dvResult.anim.Stop();

      }

      }

       

      $('html, body').animate({ scrollTop: ((tp + hgt) - $(window).height() + 20) }, 'fast');

      $(canvas).css({ width: wdt, height: hgt, left: lft, top: tp });

      displayCanvas();

      canvas.style.display = 'block';

      canvas.onmouseover = callHover;

      canvas.onmouseout = callOut;

      if (disable == 'true') {

      $('html').css({ 'overflow': 'hidden' });

      $('body').append('<img src="/web/img/pixel.png" class="helpinfocontrolclose close" style="position:absolute;top:' + (tp - 12) + 'px;left:' + parseInt(lft + wdt - 20, 10) + 'px;z-index:299998;" önclick="closeTooltipWindow();"/>');

      }

      });

      obj.mouseover(function () {

      jqtoolTiphovering = true;

      });

      obj.mouseout(function () {

      jqtoolTiphovering = false;

      });

      function callHover() {

      jqtoolTiphovering = true;

      }

      function callOut() {

      jqtoolTiphovering = false;

      }

      function displayCanvas() {

      $(canvas).css({ width: wdt, height: hgt, left: lft });

      canvas.width = wdt;

      canvas.height = hgt;

      var ctx = canvas.getContext("2d");

      ctx.clearRect(0, 0, wdt, hgt);

      ctx.save();

       

      roundRect(ctx, 11, 10, wdt - 22, hgt - 22, 10, true, true);

       

      ctx.strokeStyle = '#878787';

      ctx.beginPath();

      ctx.lineWidth = 2;

      ctx.moveTo(originx2, 25);

      ctx.lineTo(originx1, 30);

      ctx.lineTo(originx2, 35);

      ctx.fill();

      ctx.closePath();

      ctx.stroke();

       

      ctx.beginPath();

      ctx.lineWidth = 2;

      ctx.strokeStyle = '#ffffff';

      ctx.moveTo(originx2, 26);

      ctx.lineTo(originx2, 34);

      ctx.closePath();

      ctx.stroke();

      ctx.save();

      }

      function generateCondition() {

      if (oricondition != '') {

      var arrcondition = oricondition.split(',');

      var arrconditionlen = arrcondition.length;

      condition = '';

      while (arrconditionlen--) {

      var arrconditionobj = document.getElementById(arrcondition[arrconditionlen].split('=')[1]);

      if (arrconditionobj) {

      arrconditionobj = ((arrconditionobj.nodeName == 'SPAN') ? arrconditionobj.innerHTML : arrconditionobj.value);

      if (arrconditionobj != '') {

      condition = condition + ' AND ' + arrcondition[arrconditionlen].split('=')[0] + ' = \'' + arrconditionobj + '\' ';

      }

      }

      }

      }

      }

      function buildDynamicHelp(dvResult) {

      generateCondition();

      Netxert.APP.Web.NetxertAPP.getDynamicHelp(lookup, 1, min, max, searchterm, condition, function (args) {

      totalrecords = parseInt(args, 10);

      dvResult.innerHTML = '' + totalrecords + ' results found!!';

      if (totalrecords > pagesize) {

      buildPager();

      }

      if (totalrecords > 0) {

      bringResult();

      } else {

      dvResult.anim.Stop();

      }

      }, function (err) { if (err._message.indexOf('Authentication failed') >= 0) { window.location = '/SessionTimeOut.aspx'; } else { alert(err._message); dvResult.anim.Stop(); } });

      }

      function buildPager() {

      document.getElementById('dvResult' + rnd).anim.Start();

      var pager = document.getElementById('pager' + rnd);

      if (!pager) { return false; }

      pager.innerHTML = '';

      var curmax = (totalrecords >= crmax) ? crmax : totalrecords;

      var pages = Math.ceil((curmax - crmin + 1) / pagesize);

      if (crmin > max) {

      var anc = document.createElement('A');

      anc.href = "#this";

      anc.onclick = function () { crmin = crmin - max; crmax = crmax - max; buildPager(); bringResult(); }

      anc.innerHTML = "...";

      pager.appendChild(anc);

      }

      var startpage = Math.ceil(crmin * pagesize / max);

      for (var i = 1; i <= pages; i++) {

      var anc = document.createElement('A');

      anc.href = "#this";

      anc.pageno = i;

      anc.className = "page";

      anc. önclick = function () { gotoPage(this); }

      anc.innerHTML = startpage + (i - 1);

      pager.appendChild(anc);

      }

      if (totalrecords > crmax) {

      var anc = document.createElement('A');

      anc.href = "#this";

      anc.onclick = function () { crmin = crmin + max; crmax = crmax + max; buildPager(); bringResult(); }

      anc.innerHTML = "...";

      pager.appendChild(anc);

      }

      }

      function bringResult() {

      var dvResult = document.getElementById('dvResult' + rnd);

      Netxert.APP.Web.NetxertAPP.getDynamicHelp(lookup, 0, crmin, crmax, searchterm, condition, function (args) {

      if (args != '[]') {

      args = eval('(' + args + ')');

      globalresultset = args;

      recordlength = args.length;

      gotoPage(1);

      dvResult.anim.Stop();

      } else {

      dvResult.anim.Stop();

      }

      }, function (err) { if (err._message.indexOf('Authentication failed') >= 0) { window.location = '/SessionTimeOut.aspx'; } else { alert(err._message); dvResult.anim.Stop(); } });

      }

      function gotoPage(anc) {

      var pageno = (typeof (anc) == 'object') ? anc.pageno : anc;

      var tblres = document.getElementById('tblRes' + rnd);

      if (!tblres) { return false; }

      $('.searchpager a').removeClass('current');

      if (typeof (anc) == 'object') {

      anc.className = 'current';

      } else {

      $('.searchpager a.page').first().addClass('current');

      }

      startrec = ((pageno - 1) * pagesize) + 1;

      endrec = startrec + pagesize - 1;

      var strHTML = '';

      if (displayorderlen > 0) {

      for (var j = 0; j < displayorderlen; j++) {

      strHTML += '';

      }

      } else {

      for (x in globalresultset[0]) {

      strHTML += '';

      }

      }

      strHTML += '';

      tblres.innerHTML = strHTML + '

      ' + displayorder[j].replace(/_/g, ' ').replace('Room Area', 'Stocking Location').replace('SOP Code', 'Standard Instruction Code').replace('SOP Description', 'Standard Instruction Description') + '' + x.replace(/_/g, ' ').replace('Room Area', 'Stocking Location').replace('SOP Code', 'Standard Instruction Code').replace('SOP Description', 'Standard Instruction Description') + '

      ';

      var tbl = tblres.childNodes[0];

      for (var i = startrec; i <= endrec; i++) {

      if (globalresultset[i - 1] == undefined) { break; }

      var rowCount = tbl.rows.length;

      var row = tbl.insertRow(rowCount);

      row.className = "Row";

      row.data = globalresultset[i - 1];

      row.onclick = setValue;

      row.onmouseover = function () { this.style.backgroundColor = '#feffdc'; }

      row. önmouseout = function () { this.style.backgroundColor = '#ffffff'; }

      if (displayorderlen > 0) {

      for (var j = 0; j < displayorderlen; j++) {

      var cell = row.insertCell(-1);

      cell.innerHTML = globalresultset[i - 1][displayorder[j]];

      }

      } else {

      for (x in globalresultset[i - 1]) {

      var cell = row.insertCell(-1);

      cell.innerHTML = globalresultset[i - 1][x].replace(/&/g, '&');

      }

      }

      }

      hgt = $(tblres).height() + 100;

      displayCanvas();

      }

      function setValue() {

      var data = this.data;

      if (successFn) {

      successFn(data);

      Remove();

      } else {

      for (x in data) {

      objectToSet.value = data[x];

      Remove();

      break;

      }

      }

      }

      }

      function closeTooltipWindow() {

      if (document.getElementById('ctl00_Content1_btnRefreshPage')) {

      document.getElementById('ctl00_Content1_btnRefreshPage').click();

      }

      }

       

      /* Draws a rounded rectangle using the current state of the canvas.

      * If you omit the last three params, it will draw a rectangle

      * outline with a 5 pixel border radius

      * @param {CanvasRenderingContext2D} ctx

      * @param {Number} x The top left x coordinate

      * @param {Number} y The top left y coordinate

      * @param {Number} width The width of the rectangle

      * @param {Number} height The height of the rectangle

      * @param {Number} radius The corner radius. Defaults to 5;

      * @param {Boolean} fill Whether to fill the rectangle. Defaults to false.

      * @param {Boolean} stroke Whether to stroke the rectangle. Defaults to true.

      */

      function roundRect(ctx, x, y, width, height, radius, fill, stroke) {

      if (typeof stroke == "undefined") {

      stroke = true;

      }

      if (typeof radius === "undefined") {

      radius = 5;

      }

      ctx.strokeStyle = '#878787';

      ctx.fillStyle = '#ffffff';

       

      ctx.beginPath();

      ctx.lineWidth = 3;

      ctx.moveTo(x + radius, y);

      ctx.lineTo(x + width - radius, y);

      ctx.quadraticCurveTo(x + width, y, x + width, y + radius);

      ctx.lineTo(x + width, y + height - radius);

      ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);

      ctx.lineTo(x + radius, y + height);

      ctx.quadraticCurveTo(x, y + height, x, y + height - radius);

      ctx.lineTo(x, y + radius);

      ctx.quadraticCurveTo(x, y, x + radius, y);

      ctx.closePath();

      if (stroke) {

      ctx.stroke();

      }

      if (fill) {

      ctx.fill();

      }

      }

       

      $(document).click(function () {

      if (jqtoolTiphovering == false) {

      Remove();

      jqtoolTiphovering = null;

      }

      });

       

      function Remove() {

      document.getElementById("canv").style.display = 'none';

      document.getElementById('DvNotification').style.display = 'none';

      document.getElementById('ImgNotification').className = '';

      $('.anim,.helpinfocontrolclose,.helpinfocontrol,.helpinfocontrolmodal').remove();

      $('html').css({ overflow: 'auto' });

      }

      This is one js file.

      And on tabout another js file is call

       

      function ShowFrames(no) {

      if (current_tab == -1) {

      current_tab = undefined;

      }

      current_tab = ((current_tab==undefined)?no:current_tab);

      for (var i = 1; i <= crtabs; i++) {

      var ifr = document.getElementById('IFR_' + i);

      if (ifr) {

      if (document.getElementById('LI_' + i)) {

      document.getElementById('LI_' + i).className = ((i == no) ? 'current' : '');

      }

      ifr.style.display = ((i == no) ? '' : 'none');

      if (document.getElementById('Dv_' + i)) {

      document.getElementById('Dv_' + i).style.display = ((i == no && ifr.anim.stopped == false) ? 'block' : 'none');

      }

      }

      }

      if (document.getElementById('Container' + no)) {

      document.getElementById('Container' + no).innerHTML = '';

      setGradient(src_col_highlight, trg_col_highlight, 0, 'V', 29, 'Container' + no, 0, '000000', 29);

      }

      if(current_tab!=no){

      if(document.getElementById('Container'+current_tab)){

      document.getElementById('Container'+current_tab).innerHTML='';

      setGradient(src_col_normal,trg_col_normal,0,'V',29,'Container'+current_tab,0,'000000',29);

      current_tab = no;

      }}

      }

       

      this another one. This works fine in all browsers but in IE 10.But on tab out the page is start from top position in IE 10 And in other browser it open properly from where the iframe

      is present so please help me