Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将javascript onclick事件附加到锚标记_Javascript_Android_Jquery_Phonegap - Fatal编程技术网

将javascript onclick事件附加到锚标记

将javascript onclick事件附加到锚标记,javascript,android,jquery,phonegap,Javascript,Android,Jquery,Phonegap,我正试图将onclick事件附加到我的Phonegap应用程序中。它将链接到外部浏览器的位置 我的代码: pair +='<div class="card_background" style="background-image: url("http://placehold.it/600x200");" valign="bottom" class="card-header color-white no-border"><div class="card_overlay">&l

我正试图将onclick事件附加到我的Phonegap应用程序中。它将链接到外部浏览器的位置

我的代码:

pair +='<div class="card_background" style="background-image: url("http://placehold.it/600x200");" valign="bottom" class="card-header color-white no-border"><div class="card_overlay"></div><div class="animated_background"></div><h3 class="card-title">'+ results.rows.item(i).title +'</h3></div><div class="card-content"><div class="card-content-inner"><p class="color-gray event_details">Event Location:  <strong>'+ results.rows.item(i).eventlocation +'</strong></p><p class="color-gray event_details">Event Date: <strong>'+ date + " " + month + " " + year +'</strong></p><a href="#" onclick="window.open("'+ results.rows.item(i).eventOrganiserLink +'", _system, location=yes);">Google</a><br/></div></div>';
pair+=''+结果.rows.item(i).title+'

事件位置:'+results.rows.item(i).eventlocation+'

事件日期:'+Date+''+月+''+年+

内环, 后来我将其附加到div

我试图补充:

<a href="#" onclick="window.open("'+ results.rows.item(i).eventOrganiserLink +'", _system, location=yes);">Google</a>

这给了我错误


Thanx提前

我已经简化了您的代码。考虑以下事项:

var pair = '';
var eventOrganiserLink = '[EVENT ORGANISER LINK]';

pair += '<a href="#" onclick="window.open("'+ eventOrganiserLink +'", _system, location=yes);">Google</a>';
<a href="#" onclick="window.open("[EVENT ORGANISER LINK]", _system, location=yes);">Google</a>
这将产生:

<a href="#" onclick="window.open('[EVENT ORGANISER LINK]', _system, location=yes);">Google</a>


请注意
[活动组织者链接]
周围的单引号。还要注意颜色现在匹配。

看看引号的开始和结束:“and”。这
onclick=“window.open”(…
将在
打开之后立即关闭onclick属性(
。其余代码不会在onclick中结束attribute@Meldon我怎么才能解决这个问题?我不明白。请你帮我重写一下,谢谢你的帮助,非常感谢。
<a href="#" onclick="window.open('[EVENT ORGANISER LINK]', _system, location=yes);">Google</a>