Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Using JavaScript to set values on a web page - Help Needed on Setting Checkbox

Post Reply
User avatar
salvadordf
Posts: 4032
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Using JavaScript to set values on a web page - Help Needed on Setting Checkbox

Post by salvadordf »

The w3schools link for getBoundingClientRect has a "Try it" button with the code you're looking for :

Code: Select all

  var div = document.getElementById("myDiv");
  var rect = div.getBoundingClientRect();
  x = rect.left;
  y = rect.top;
  w = rect.width;
  h = rect.height;
  alert ("Left: " + x + ", Top: " + y + ", Width: " + w + ", Height: " + h);
gresaggr
Posts: 22
Joined: Mon Mar 04, 2019 12:41 pm

Re: Using JavaScript to set values on a web page - Help Needed on Setting Checkbox

Post by gresaggr »

Try this

Code: Select all

...
{ if ((items[i].name == "piiCheckBox") and (!items[i].checked))  {items[i].click(); }
gresaggr
Posts: 22
Joined: Mon Mar 04, 2019 12:41 pm

Re: Using JavaScript to set values on a web page - Help Needed on Setting Checkbox

Post by gresaggr »

stwizard wrote: Mon Aug 19, 2019 12:48 am Greetings Salavadord,

I know "..." means code preceding the line you wanted me to try, but what code precedes It to then use items?

Mike
JSCode:='document.getElementsByTagName("INPUT"); for (var i = 0; i < items.length; i++) { if ((items.name == "piiCheckBox") and (!items.checked)) {items.click(); }';
Post Reply