4

This is my simple HTML page and I want to target the specific area to auto click on the blue area after page load. Can anyone create an HTML, PHP or JavaScript file for me?

HTML page: http://imgily.com/Speific-Area-Click.html

Example screenshot of specific area:

enter image description here

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • 2
    This is not a "do it for me" website. We try to assist and help where we can, but your question is not clear enough for us to help. Have a look through [this page](http://stackoverflow.com/help/how-to-ask) on how to ask a good question. Show us some research, and some code samples, and we would be happy to help. – Blue Jun 08 '15 at 11:51
  • Is this blue area a dive image or what.. it would be better if you can paste your code too – PHP Worm... Jun 08 '15 at 11:54
  • @deanna please consider doing something on your own.. SO is not about to help you make whole programs of applications... thanks – Nishant Solanki Jun 08 '15 at 13:05

2 Answers2

0


You can use html2canvas for capture your screen area and transform to canvas.
Then you can iterate thought the canvas and find the blue pixel (make an algo)..

// Do something like that
html2canvas(document.body, {
    onrendered: function(canvas) {
        var context = canvas.getContext();
        var imgData = context.getImageData(0, 0, canvas.width,canvas.height);
        var data = imgData.data;

        // enumerate all pixels
        // each pixel's r,g,b,a datum are stored in separate sequential array elements
        // from : http://stackoverflow.com/questions/17714742/looping-through-pixels-in-an-image

        for(var i=0; i < data.length; i+=4) {
            var red = data[i];
            var green = data[i+1];
            var blue = data[i+2];
            var alpha = data[i+3];


        }
    }
});
elcid9
  • 147
  • 4
0

you can use document.ready function of jquery.. put a button at that blue area (i.e you can apply some css to that button which will make it with same look and feel)

<input type='button' id='button' />

and you can trigger an click event using jquery

<script type="text/javascript">
    $( document ).ready(function() {
      $("#button").trigger('click'); 
    });
</script>

OR

<script type="text/javascript">
    jQuery(function(){
       jQuery('#button').click();
    });
</script>

EDIT

for the html link you provided you should use script like below

<script type="text/javascript">
    $( document ).ready(function() {
      $("#google_image_div a").trigger('click'); 
    });
</script>

let me know if any help needed..

Nishant Solanki
  • 2,119
  • 3
  • 19
  • 32
  • hey thanks for your answer,can you please tell me about auto ad click script? example html page : http://healthtips2.ml/Health-and-Wellness-Products.html – Deanna Jasmine Jun 08 '15 at 19:27
  • hey @nishant-solanki Please send your email id or email me at DeanaJasmine5555@gmail.com . Need some help. Thanks – Deanna Jasmine Jun 09 '15 at 09:21