Jump to content
Sign in to follow this  
Larsen8040

Cant click links on clipboard IE page

Recommended Posts

Larsen8040

There are several links on this page that I need to click. One is "Names" one is "Physical Addresses" and one is "Telephone Numbers"

I have tried the following code

$oName = _IEGetObjById($oIE, "name")
 _IEAction($oName, "click")

I used the same for the IDs for address and telephone number too... but none of them click.

Heres the page source. The IDs I was using are at the bottom.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TLOxp - Clipboard</title>  <style>
   body, textarea
   {
    background-color:#ffffff;
    font-family:arial;
    font-size:12px;
    padding:0;
    margin:0;
   }
   #graball
   {
    height:50px;
    line-height:24px;
    background-color:#e8e8d6;
    text-align:center;
    vertical-align:middle;
    width:100%;
    min-width: 600px;
   }
   #graball span
   {
    padding-left: 5px;
    padding-right: 5px;
    text-decoration: underline;
   }
   #graball span:hover
   {
    text-decoration: underline;
   }
   #clip
   {
    top:30px;
   }
   #content
   {
    width:98%;
    padding-top:5px;
    padding-left:5px;
    text-align:center;
    min-width: 600px;
   }
   input
   {
    margin-right: 10px;
   }
   #print
   {
    margin-left: 20px;
   }
  </style>
  <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
  <script type="text/javascript">
   var rowid = 'datarow_1';
   var _last = '';

   if (window.opener) {
    //window.onload = window.opener._clipWindowOnLoad;
   }

   function isSuffix(part)
   {
    switch (part.toUpperCase())
    {
     case 'JR':
     case 'SR':
     case 'I':
     case 'II':
     case 'III':
     case 'IV':
     case 'V':
     case 'VI':
     case 'VII':
     case 'VIII':
     case 'IX':
     case 'X':
     case '1ST':
     case '2ND':
     case '3RD':
     case '4TH':
     case '5TH':
     case '6TH':
     case '7TH':
     case '8TH':
     case '9TH':
     case '10TH':
      return true;
    }

    return false;
   }

   function appendContents(text, field)
   {
    text = text.toUpperCase().replace(/<BR>/g, ' ').replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, '').replace(/^\s+/, '').replace(/\s+$/, '').replace(/\s+/g, ' ');

    if ($("#lastnamefirst:checked").val())
    {
     switch (field)
     {
      case 'name':
       if (text.indexOf(' ') != -1)
       {
        var append = '';

        if (text.indexOf('(') != -1)
        {
         append = text.substr(text.indexOf('('));
         text = text.substr(0, text.indexOf('('));
        }

        text = $.trim(text);
        var parts = text.split(' ');
        var end = parts.length - 1;
        text = parts[end];

        if (isSuffix(parts[end]))
        {
         end--;
         text = parts[end] + ' ' + text;
        }

        if (parts.length > 1)
        {
         text = text + ',';

         for (var i=0; i < end; i++)
         {
          text = text + ' ' + parts[i];
         }
        }

        text = $.trim(text + ' ' + append);
       }
       break;
     }
    }

    if ($("#puncuation:checked").val())
    {
     switch (field)
     {
      case 'phone':
       var phone = text.match(/(?:[^0-9]*[0-9]){10}/);

       if (phone != null)
       {
        text = phone[0].replace(/[^0-9]/g, '') + text.substr(phone[0].length);
       }
       break;
      case 'ssn':
       text = text.replace(/[^0-9X]/g, '').replace();
       break;
     }
    }

    if ($('#clip').val() != '')
    {
     $('#clip').val($('#clip').val() + "\n" + text);
    }
    else
    {
     $('#clip').val(text);
    }
   }

   function copyElements(e)
   {
    _last = $('#clip').val();
  
    // grab the elements that exist from the parent window
    var _elementList = window.opener.getElementValuesFromTitle(rowid, e.id);
    if (_elementList !== 'undefined' && _elementList.length > 0)
    {
     for (var i in _elementList)
     {
      _elementList[i] = _elementList[i].replace("[ Copy to Clipboard ]","");
      appendContents(_elementList[i], e.id);
     }
    }

    //document.getElementById('clip').focus(); 
    var _textLength = $('#clip').val().length;
    setSelRange($('#clip'), _textLength, _textLength);
    $('#undo').prop('disabled', false);
    return false;
   }

   function setSelRange(inputEl, selStart, selEnd) {
    if (inputEl.setSelectionRange) {
     inputEl.focus();
     inputEl.setSelectionRange(selStart, selEnd);
    } else if (inputEl.createTextRange) {
     var range = inputEl.createTextRange();
     range.collapse(true);
     range.moveEnd('character', selEnd);
     range.moveStart('character', selStart);
     range.select();
    }
   }

   function closeWindow()
   {
    window.close();
   }

   function clearContents()
   {
    $('#clip').val('');
    $('#undo').prop('disabled', true);
   }

   function undo()
   {
    $('#clip').val(_last);
    $('#undo').prop('disabled', true);
   }


   function onLoad()
   {
    return false;
   }
  </script>
</head>
<body onload="onLoad();" onbeforeunload="window.opener.nullWindow(document.getElementById('clip').value);">

<div id="graball">
  Copy:  &nbsp;&nbsp;&nbsp;
  <span><a id="person" href="#" onclick="return copyElements($('#email')[0]) || copyElements($('#ip')[0]) || copyElements($('#address')[0]) || copyElements($('#name')[0]) || copyElements($('#phone')[0]) || copyElements($('#ssn')[0]) || copyElements($('#dl')[0]);">Person</a></span>
  <span><a id="email" href="#" onclick="return copyElements(this);">Email Addresses</a></span>
  <span><a id="ip" href="#" onclick="return copyElements(this);">IP Addresses</a></span>
  <span><a id="address" href="#" onclick="return copyElements(this);">Physical Addresses</a></span>
  <span><a id="name" href="#" onclick="return copyElements(this);">Names</a></span> 
  <span><a id="phone" href="#" onclick="return copyElements(this);">Telephone Numbers</a></span>
  <span><a id="ssn" href="#" onclick="return copyElements(this);">SSNs</a></span>
  <span><a id="dl" href="#" onclick="return copyElements(this);">DLs</a></span><br />
  <input type="checkbox" id="lastnamefirst" value="1" /> Last Names First
  <input type="checkbox" id="puncuation" value="1" /> No Punctuation on Telephone Numbers or SSNs
  <a id="print" href="#" onClick="window.print();return false;">Print</a>
</div>
<div id="content">
  <textarea spellcheck="false" id="clip" style="width:100%" rows=20 onKeyDown="$('#undo').prop('disabled', true)"></textarea>
  <div style="text-align: center;">
   <br>
   <input id="undo" type="button" value="Undo" onClick="undo();" disabled="disabled" /><input type="button" value="Clear Window" onclick="return clearContents();"><input type="button" value="Close Window" onclick="closeWindow();"><br /><br />
   <a href="comment.php?type=suggestion&url=https%3A%2F%2Ftloxp.tlo.com%2FshowClipboard.php%3Frow_id%3Ddatarow_1" target="_blank">Send us Suggestion</a>
  </div>
</div>
</html>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×