Javascript 有序列表中HTML中的超链接

Javascript 有序列表中HTML中的超链接,javascript,html,Javascript,Html,所以我必须在这个有序列表中添加第5项,第5项必须是超链接的。我把我正在读的东西放在网上,但它不起作用 // create an ordered list document.write("<ol>"); document.write("<li>Reduce spending on non-necessities.</li>") document.write("<li>Use extra money to pay off debt,starting w

所以我必须在这个有序列表中添加第5项,第5项必须是超链接的。我把我正在读的东西放在网上,但它不起作用

// create an ordered list
document.write("<ol>");
document.write("<li>Reduce spending on non-necessities.</li>")
document.write("<li>Use extra money to pay off debt,starting with the 
highest-interest credit card.</li>")
document.write("<li>Continue paying off debts until you are debt free.</li>")
document.write ("<li>Put a fixed percent of your pay aside in savings.</li>")
document.write ("<li> <a href="https://www.financial-planning.com/"> Financial Planning </a> </li>")
document.write("</ol>");
//创建一个有序列表
文件。填写(“”);
记录。写下(“
  • 减少非必需品的支出。
  • ”) 写下(“
  • 用额外的钱来偿还债务,从 最高利息信用卡。
  • ”) 记录。写下(“
  • 继续偿还债务,直到你没有债务为止。
  • ”) 写下(“
  • 把你工资的固定百分比存起来作为储蓄。
  • ”) document.write(“
  • ”) 文件。填写(“”);

    我得到这个错误。“分析错误:预期的令牌https

    请尝试使用单引号包装
    li


    document.write(“
  • ”)
    尝试用单引号包装
    li


    document.write('
  • ')
    格式不正确。请删除双引号,并在地址周围添加单引号

    请尝试以下操作:

    "<li> <a href='https://www.financial-planning.com/'> Financial Planning </a> </li>"
    

  • 它的格式不正确。请删除双引号并在地址周围添加单引号

    请尝试以下操作:

    "<li> <a href='https://www.financial-planning.com/'> Financial Planning </a> </li>"
    

  • 如果您有一个字符串,并且希望在其中加引号,请首先使用双引号,然后在单引号中使用双引号:

    "<li> <a href='https://www.financial-planning.com/'> Financial Planning </a> </li>"
    
    '<li> <a href="https://www.financial-planning.com/"> Financial Planning </a> </li>'
    
  • ” “

  • 如果您有一个字符串,并且希望在其中加引号,请首先使用双引号,然后在单引号中使用双引号:

    "<li> <a href='https://www.financial-planning.com/'> Financial Planning </a> </li>"
    
    '<li> <a href="https://www.financial-planning.com/"> Financial Planning </a> </li>'
    
  • ” “
  • 您必须按原样传递“char”才能写入函数。为此,可以使用escape char()或单引号(')

    document.write(“”);
    记录。写下(“
  • 减少非必需品的支出。
  • ”) 记录。写(“
  • 用额外的钱来还债,从利息最高的信用卡开始。
  • ”) 记录。写下(“
  • 继续偿还债务,直到你没有债务为止。
  • ”) 写下(“
  • 把你工资的固定百分比存起来作为储蓄。
  • ”) document.write(“
  • ”) 文件。填写(“”);
    您必须按原样传递“char”来编写函数。要传递,您可以使用escape char()或单引号(')

    document.write(“”);
    记录。写下(“
  • 减少非必需品的支出。
  • ”) 记录。写(“
  • 用额外的钱来还债,从利息最高的信用卡开始。
  • ”) 记录。写下(“
  • 继续偿还债务,直到你没有债务为止。
  • ”) 写下(“
  • 把你工资的固定百分比存起来作为储蓄。
  • ”) document.write(“
  • ”) 文件。填写(“”);
    只需在外部使用单引号即可

    像这样:

    '<li> <a href="https://www.financial-planning.com/"> Financial Planning </a> </li>'
    

  • 只需在外部使用单引号即可

    像这样:

    '<li> <a href="https://www.financial-planning.com/"> Financial Planning </a> </li>'