Can anyone tell me what's wrong with this part of code from some javascript.
function DoPrompt(action,myTarget) {
var revisedMessage;
var currentMessage = eval('document.form1.'+myTarget+'.value');
if (action == "url"
{
var thisURL = prompt("Enter the complete URL for the link you wish to add.", "if(thisURL!=null){
var urlUBBCode = "";
var urlUBBCode = "<a href="+thisURL+" class='b' target='_blank' onFocus='if(this.blur)this.blur()'>"+thisURL+"</a>";
revisedMessage = eval('document.form1.'+myTarget+'.value'+urlUBBCode);
eval('document.form1.'+myTarget+'.value+=\"'+revisedMessage+'\";');
eval('document.form1.'+myTarget+'.focus();');
return;
}
}
The story is, I have a some formatting buttons that go above a couple of textareas, each textarea has it's own name and I pass this into the function in the variable myTarget, whenever I run this script I get an error for the line that goes var urlUBBCode = "<a href="+..... saying that it's missing a ;
Is there a work around I should use?
Thanks in advance
function DoPrompt(action,myTarget) {
var revisedMessage;
var currentMessage = eval('document.form1.'+myTarget+'.value');
if (action == "url"
var thisURL = prompt("Enter the complete URL for the link you wish to add.", "if(thisURL!=null){
var urlUBBCode = "";
var urlUBBCode = "<a href="+thisURL+" class='b' target='_blank' onFocus='if(this.blur)this.blur()'>"+thisURL+"</a>";
revisedMessage = eval('document.form1.'+myTarget+'.value'+urlUBBCode);
eval('document.form1.'+myTarget+'.value+=\"'+revisedMessage+'\";');
eval('document.form1.'+myTarget+'.focus();');
return;
}
}
The story is, I have a some formatting buttons that go above a couple of textareas, each textarea has it's own name and I pass this into the function in the variable myTarget, whenever I run this script I get an error for the line that goes var urlUBBCode = "<a href="+..... saying that it's missing a ;
Is there a work around I should use?
Thanks in advance