Time remaining:
Adding function in javascript using C# (bho)

Programming
Tutor: None Selected Time limit: 0 Hours

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 30th, -0001

hi 


I can be able to assist you for this code.



Aug 29th, 2014

Are you studying on the go? Check out our FREE app and post questions on the fly!
Download on the
App Store
...
Nov 30th, -0001
...
Nov 30th, -0001
Dec 5th, 2016
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