Time remaining:

Adding function in javascript using C# (bho)


label Programming
account_circle Unassigned
schedule 0 Hours
account_balance_wallet $5

Hy  :D  i have one bho (browser helper object ) and i need to add this function in javascript

(

function () {
  var nova = document.getElementById('PartNumberTextBox');
  var so = document.getElementById('so_id');
  var newsn = document.getElementById('new_sn');
  var button = document.getElementById('book_button');
  var newpart = document.getElementById('new_part_no');
  document.body.onkeyup = function (e) {
  if (e === null) e = window.event;
  var code = e.keyCode || e.which;
  if (code == '9') {
  if (e.srcElement == newsn) {
  so.focus();
  } else if (e.srcElement == so) {
  button.focus();
  } else {
  nova.focus();
  }
  }
  };

  nova.onchange = novafunc;
  nova.onblur = novafunc;
  nova.onkeyup = novafunc;
  nova.onmouseup = novafunc;

  function novafunc() {
  if (newpart.value === nova.value && nova.value.length > 0) {
  nova.style.backgroundColor = '#0f0';
  newsn.focus();
  } else {
  nova.style.backgroundColor = '#f00';
  }
  }

})();

to a certain page using c#  ...  ... What's the best solution ?
The page just contains frameset and frames ... and i have used this method to add the textbox on the page ...

  IHTMLElement head= (IHTMLElement)((IHTMLElementCollection)document.all.tags("head")).item(null, 0);
  IHTMLScriptElement scriptObject =(IHTMLScriptElement)document.createElement("script");
  scriptObject.type = @"text/javascript";
  scriptObject.text = @"
 var inp = document.createElement('input');
  inp.id = 'PartNumberTextBox';
  inp.style.position = 'absolute';
  inp.style.right = '6px';
  inp.style.top = '435px';
  inp.style.width = '280px';
  inp.style.backgroundColor = '#000494';
var framex = window.frames;
for (var i = 0; i < framex.length; i++) {
  framex[i].document.body.appendChild(inp);
}";
  ((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);

can you please help me to add the javascript on the page ? thanks
Nov 24th, 2017

hi 


I can be able to assist you for this code.



Aug 29th, 2014

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Nov 24th, 2017
...
Nov 24th, 2017
Nov 25th, 2017
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer