我想将一个 html 页面传递给 jquery 函数。我的html页面是这样的
var string="
<html>
<body>
<p class='myclass' >some content comees hre</p>
<p><img src='localhost/images/img1.jpg' border='0' width='100' height='100' ></p>
</body>
</html>";
我尝试将此字符串传递给这样的函数
var varfunc_call= Click</ a>
我无法更改字符串中的单引号。在函数调用区域中没有单引号的调用函数。但在函数定义字符串内部显示一些错误。此外,所有单引号都会自动更改为双引号。
我该如何解决这个问题。请帮我。
I want to pass one html page to a jquery function. My html page is like this
var string="
<html>
<body>
<p class='myclass' >some content comees hre</p>
<p><img src='localhost/images/img1.jpg' border='0' width='100' height='100' ></p>
</body>
</html>";
I tried pass this string to a function like this
var varfunc_call= <a href="#" onclick="JQuery.myplugin.Myfunction('"+string+"')">Click</a>
I cannot change single quotes in my string. In function call area with out single quotes its calling function. But inside function definition string showing some errors. Also all single quotes are automatically changing to double quotes.
How can I fix this issude. Please help me.
发布评论
评论(1)
如果您希望生成一个使用繁重且复杂的字符串执行某些函数的链接,则不应将其连接到 HTML。
您可以使用:
If you're looking to generate a link that excecutes some function with a heavy and complex string, you shouldn't be concatenating it to HTML.
You can use: