issue with apostrophes in a function with div.innerHTML

This question already has an answer here:

  • How to escape single quotes within single quoted strings? 19 answers

  • 你可以像这样逃避你的字符串:

    div.innerHTML ='<div id="link"><input type="button" onclick="location.href='http://www.google.com/';"/></div>';
    
    链接地址: http://www.djcxy.com/p/57140.html

    上一篇: 如何使用包含单引号的字符串使用bash变量?

    下一篇: 问题与div.innerHTML函数中的撇号