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

94
Views
Make JavaScript link open in new window with document.write

I'm to figure out how to code so that the link opens into a new window? Is this the correct way to do that?

<script>
  var copyright = "&copy; ";
  var d = new Date();
  var n = d.getFullYear();
  var db = " Doing Business";
  var str = new String(" Link");
  document.write(copyright + n + str.link("https://www.google.com"));
  document.write(db); 
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Please stop using String.link. It's old, deprecated, and smelly. It also doesn't support what you are trying to do.

You can construct a link with the appropriate target attribute (read more) to open in a new tab as follows:

var myLink = "<a target='_blank' href='https://www.google.com'>Link</a>";
document.write(copyright + n + " " + myLink);
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!