如何在javascript中插入变量值:(这里)

时间:2014-09-18 12:31:12

标签: javascript

我想在^之后将值插入javascript:DoRowAny(此处)

var totalApps = 0^NOT_DECIDED~P~TUYTR78YT; //dynamically generated
var totalNumber = totalApps.split('^')[0];
var totalId = totalApps.split('^')[1];

var totalapp = '<a class="app" data-placement="top" data-original-title="' + totalNumber + ' in total."href="javascript:DoRowAny();" >' + totalNumber + ' not decided.</a>' ;

javascript:DoRowAny(totalId)//我认为这样可行,但事实并非如此。纯javascript而不是jquery。

<a class="tooltip-item action-reqd" data-placement="top" data-original-title="View 0 applications<br>requiring pre-decision action." target="_parent" href='javascript:DoRowAny("YES_DECIDED~YD~TPPEUR98UYD01");'>0</a>


function DoRowAny(id) // 
     {  
            document.getElementById('#inputOne').value=id;  //inserts the value of the id into the input
            document.getElementById('#buttonThree').click(); //and then clicks button 3
            return true;
            };

1 个答案:

答案 0 :(得分:1)

试试这个 -

使用转义'

var totalapp = '<a class="app" data-placement="top" data-original-title="' + totalNumber + ' in total." href="javascript:DoRowAny(\''+totalId+'\');" >' + totalNumber + ' not decided.</a>';

DEMO