简体   繁体   English

我的javascript函数调用的HTML异常显示?

[英]HTML bizarre rendering of my javascript function call?

I am getting the following error in the big three (IE, Chrome, FF): 我在三巨头(IE,Chrome,FF)中遇到以下错误:

Uncaught SyntaxError: Unexpected token }

When I look at the rendered html in dev tools I see this: 当我在开发工具中查看呈现的html时,会看到以下内容:

<div style="...">
  <a style="..." onclick="LaunchTemplateBrowser(" href="#" false;'="" 'x_project');return="" c74767f5-6ce4-4975-9778-e4f9ad1e5ded',="">
    <img style="..." src="...">
  </a>
  <span style="...">Add from template</span>
  <br><br>
  <a style="..." onclick="LaunchItemInsert();return false;" href="#">
    <img style="..." src="...">
  </a>
  <span style="color: rgb(139, 139, 139);">Add single item</span>
</div>

The important lines above are 2 and 7. On line 2 I am passing a guid and that seems to be throwing it for a loop? 上面的重要行是2和7。在第2行上,我正在传递一个Guid,这似乎将其抛出循环?

The source code is: 源代码是:

<html>
  <head></head>

  <body>   
    <title></title>

    <div style="...">
        <div style="...">
            <a href="#" style="..." onclick="LaunchTemplateBrowser('C74767F5-6CE4-4975-9778-E4F9AD1E5DED', 'x_project');return false;" >
            <img style="..." src="..." />
            </a>
            <span style="...">Add from template</span>
            <br /><br />
            <a href="#" style="..." onclick='LaunchItemInsert();return false;' >
                <img style="..." src="..." />
            </a>
            <span style="...">Add single item</span>
        </div>
    </div>

</body>

You should escape the quotes before using them. 使用引号之前,请先转义它们。

Either by prefixing them with \\ or using a combination of single and double quotes. 可以在它们前面加上\\或使用单引号和双引号的组合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM