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

143
Views
Can't make a on click button to open an iframe

I can't execute this code in console, I want to make a onclick button to open an iframe but when I paste it on console, it says "Uncaught SyntaxError: Unexpected token ';'", any help? thanks!

document.getElementsByClassName("search-bar hp")[0].innerHTML = ("<button class=\'btn btn-primary btn-sm\' onclick=\'AbsenKuy()\'style=\'background-color:#000000;color:white;\'><span class=\'fa fa-bug\'> Auto Absensi</span></button>";

function AbsenKuy() {

document.getElementsByClassName("post-topbar")[0].innerHTML = "<iframe width=\'150 height=\'100\' src='http://elearning-man2kotabogor.sch.id/studentkelas/absensi/MTEyNUtaWQ==/U0VOQlVEX1hJX0tJTUlBX0FZRQ==/MTEyNQ=='></iframe>";
};

document.getElementsByClassName("search-bar hp")[0].innerHTML = ("<button class=\'btn btn-primary btn-sm\' onclick=\'AbsenKuy()\'style=\'background-color:#000000;color:white;\'><span class=\'fa fa-bug\'> Auto Absensi</span></button>";
function AbsenKuy() {
document.getElementsByClassName("post-topbar")[0].innerHTML = "<iframe width=\'150 height=\'100\' src='http://elearning-man2kotabogor.sch.id/studentkelas/absensi/MTEyNUtaWQ==/U0VOQlVEX1hJX0tJTUlBX0FZRQ==/MTEyNQ=='></iframe>";
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is you have missed some closing brackets in the script.

document.getElementsByClassName("search-bar hp")[0] = ("<button class=\'btn btn-primary btn-sm\' onclick=\'AbsenKuy()\'style=\'background-color:#000000;color:white;\'><span class=\'fa fa-bug\'> Auto Absensi</span></button>");

function AbsenKuy() {

document.getElementsByClassName("post-topbar")[0].innerHTML = "<iframe width=\'150 height=\'100\' src='http://elearning-man2kotabogor.sch.id/studentkelas/absensi/MTEyNUtaWQ==/U0VOQlVEX1hJX0tJTUlBX0FZRQ==/MTEyNQ=='></iframe>"
};

document.getElementsByClassName("search-bar hp")[0] = ("<button class=\'btn btn-primary btn-sm\' onclick=\'AbsenKuy()\'style=\'background-color:#000000;color:white;\'><span class=\'fa fa-bug\'> Auto Absensi</span></button>");

function AbsenKuy() {
document.getElementsByClassName("post-topbar")[0].innerHTML = "<iframe width=\'150 height=\'100\' src='http://elearning-man2kotabogor.sch.id/studentkelas/absensi/MTEyNUtaWQ==/U0VOQlVEX1hJX0tJTUlBX0FZRQ==/MTEyNQ=='></iframe>"
};

This modified code will prevent that error. All the best.

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!