Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
How to use screenshot api?

I am practicing to capture screenshot of webpage by using api.

I want to change the img src, on the button click.

Code is as follows:

<section>   
  <div class="urldiv">
    <label for="Url">Url</label>. 
          <br>
    <input type="text" name="Url" 
     id="input" value="" />   
 
  </div>   
  <div class="ss">
    <img id="sh" src="https://api.screenshotmachine.com?key=c04d3a&url=screenshotmachine.com&dimension=1024x768"/>
     </div>   
  <button onclick="changeimg()">Capture</button>
 </section>

And this is JavaScript:

<script type="text/javascript" charset="utf-8">
     
        var url = document.getElementById("input").value;
       function changeimg() {
        document.getElementById("screenshot").src = "https://api.screenshotmachine.com?key=c04d3a&url=" + url + "&dimension=1024x768";
      }
    </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should get the input value inside the function and the img id is sh not screenshot

Now it's work

         const input = document.getElementById("input");
         function changeimg() {
         document.getElementById("sh").src = "https://api.screenshotmachine.com?key=c04d3a&url=" + input.value + "&dimension=1024x768";
         }
      <section>
         <div class="urldiv">
            <label for="Url">Url</label>. 
            <br>
            <input type="text" name="Url" id="input" value="" />
            <button onclick="changeimg()">Capture</button>
         </div>
         <div class="ss">
            <img id="sh" src="https://api.screenshotmachine.com?key=c04d3a&url=screenshotmachine.com&dimension=1024x768"/>
         </div>
      </section>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!