By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,350 Members | 1,456 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,350 IT Pros & Developers. It's quick & easy.

Passing an alphanumeric string value to a javascript function in js file

P: 2

A js file containing a function which is passing an alphanumeric string to another function in the same file, the second funtion requires 4 parameters to pass from the first function.
The first three are the number and the last one is the alphanumeric string , but when I apply the fourth parameter , it throws out an error Expected';'

The value in the varval parameter are like '2 xyz', '4 abc'

The calling fucntion is being called link this
Expand|Select|Wrap|Line Numbers
  1. func1 {
  2. .......
  3. document.getElementById('inlineEdit_'+recid).innerHTML += '<a onClick="cancelEdit('+recid+','+ count_sqlChangeSet+','+currpage+','+varval+')" class="revertEditing" title="Cancel" id="revert"><img src="" border="0" /></a>'
  4. ...... }
Under is the called function

Expand|Select|Wrap|Line Numbers
  1. function cancelEdit(recid,count_sqlChangeSet,currpage,changeSetNo)
  2. { //changeSetNo = '2 xyz';
  3.         alert(changeSetNo);
  5.     document.getElementById('inlineEdit_'+recid).innerHTML = '<a onclick="inlineedit('+recid+','+ count_sqlChangeSet+','+currpage+')" >Inline Edit</a>'
  6.     document.getElementById('changeSetNo_'+recid).innerText = changeSetNo;
  7. }
Please help..

Aug 28 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 5,390
you need to concat the corresponding qoutes to the link where you build the call ... since the params needs to be passed as strings ...

kind regards
Aug 28 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.