Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript problem please help!!

Status
Not open for further replies.

rkferri

Programmer
Jul 26, 2004
17
US
I have a web application that is written in .asp when I hit on one of the web controls to allow me to upload a .pdf I keep getting the following error:

Line: 39
Char: 43
Error: Syntax Error
Code: 0

Here is my code that I am using. Line 39 is where the code var sCheckFlag = ""; is at:

<script language="JavaScript">

var sAction = "INSERT";
var sTitle = "INSERT";

var oControl;
var oSeletion;
var sRangeType;

var v_imgname = "";
var v_Title = "";
var v_Target = "";
var v_linkcolor = "";

var sCheckFlag = "";

var oControl = "window.dialogArguments";

if(oControl)
{
v_imgname = oControl.getAttribute("href",2) ;
alert(oControl.style.color);
alert(oControl.getAttribute("target")); ...adam
v_Title = oControl.title;
v_Target = oControl.target;
v_linkcolor = oControl.style.color;

if(v_Target == "" || v_Target == null)
v_Target = "Not set";
alert(oControl.style.color);
}

var parameters = new Array(); //adam send an array instead of one value!

function insert_document()
{
if (imgname.value == "") {
alert("Please choose a document");
return false;
}

parameters['href'] = imgname.value;
parameters['Title'] = Title.value;
if (Target.value == "Not set")
parameters['Target'] = ""
else
parameters['Target'] = Target.value;
parameters['linkcolor'] = linkcolor.value;;
alert(parameters['href']);

window.returnValue = parameters;
window.close();
}
function UploadSaved(sFileName){
imgname.value = sFileName;
}

function attr(name, value)
{
if (!value || value == "") return "" ;
return ' ' + name + '="' + value + '"' ;
}

function Check(t,n)
{
if(n==1) {
t.style.border = "1px solid #00107B";
t.style.background = "#F1EEE7";
}
else {
t.style.border = "1px solid buttonface";
t.style.background = "buttonface";
}
}
function Init()
{
if(v_imgname!= "")
{
imgname.value = v_imgname;
Title.value = v_Title;
Target.value = v_Target;
linkcolor.value = v_linkcolor;
s_linkcolor.style.backgroundColor = v_linkcolor;
}
}

function Setcolor()
{
var orginalcolor = s_linkcolor.style.backgroundColor;
if(orginalcolor==null){
var sColor=document.dlgHelper.ChooseColorDlg();
else
var sColor=document.dlgHelper.ChooseColorDlg(orginalcolor);
if(sColor!=null&&sColor!="")

sColor = sColor.toString(16);
if(sColor.length<6)
{
var sTempString="000000".substring(0,6-sColor.length);
sColor=sTempString.concat(sColor);
};
linkcolor.value='#'+sColor.toUpperCase();
s_linkcolor.style.backgroundColor=sColor;
}
return;
}

</script>

Does anyone see anything wrong with this?? Any help would be greatly appreciated. Thanks in advance!
Kelly
 
I didn't checked it, but looks like "...adam" is not commented with // or /* */.
 
Thanks vongrunt that got me passed that error. Now I'm getting another one!!!! Arggggggg!!!! I'm not very good with Javascript I'm just learning so I'm pulling my hair out!!

The next error is this:
Line: 108
Char: 3
Error: Syntax Error
Code: 0


Line 108 is the first if statement after the Function SetColor()

<script language="JavaScript">

var sAction = "INSERT";
var sTitle = "INSERT";

var oControl;
var oSeletion;
var sRangeType;

var v_imgname = "";
var v_Title = "";
var v_Target = "";
var v_linkcolor = "";

var sCheckFlag = "";

var oControl = "window.dialogArguments";

if(oControl)
{
v_imgname = oControl.getAttribute("href",2) ;
alert(oControl.style.color);
alert(oControl.getAttribute("target")); ...adam
v_Title = oControl.title;
v_Target = oControl.target;
v_linkcolor = oControl.style.color;

if(v_Target == "" || v_Target == null)
v_Target = "Not set";
alert(oControl.style.color);
}

var parameters = new Array(); //adam send an array instead of one value!

function insert_document()
{
if (imgname.value == "") {
alert("Please choose a document");
return false;
}

parameters['href'] = imgname.value;
parameters['Title'] = Title.value;
if (Target.value == "Not set")
parameters['Target'] = ""
else
parameters['Target'] = Target.value;
parameters['linkcolor'] = linkcolor.value;;
alert(parameters['href']);

window.returnValue = parameters;
window.close();
}
function UploadSaved(sFileName){
imgname.value = sFileName;
}

function attr(name, value)
{
if (!value || value == "") return "" ;
return ' ' + name + '="' + value + '"' ;
}

function Check(t,n)
{
if(n==1) {
t.style.border = "1px solid #00107B";
t.style.background = "#F1EEE7";
}
else {
t.style.border = "1px solid buttonface";
t.style.background = "buttonface";
}
}
function Init()
{
if(v_imgname!= "")
{
imgname.value = v_imgname;
Title.value = v_Title;
Target.value = v_Target;
linkcolor.value = v_linkcolor;
s_linkcolor.style.backgroundColor = v_linkcolor;
}
}

function Setcolor()
{
var orginalcolor = s_linkcolor.style.backgroundColor;
if(orginalcolor==null){
var sColor=document.dlgHelper.ChooseColorDlg();
else
var sColor=document.dlgHelper.ChooseColorDlg(orginalcolor);
if(sColor!=null&&sColor!="")

sColor = sColor.toString(16);
if(sColor.length<6)
{
var sTempString="000000".substring(0,6-sColor.length);
sColor=sTempString.concat(sColor);
};
linkcolor.value='#'+sColor.toUpperCase();
s_linkcolor.style.backgroundColor=sColor;
}
return;
}

</script>


Do you see anything wrong with this?? Thanks again!!
Kelly

 
Er... looks like the same code again.

I'm not sure how Setcolor() must look, but "{" after first if() is kind of misplaced... maybe it should be after 2nd if() ?
 
Thanks Again vongrunt!! I know this code is messed up!! We didn't write it we bought the product and you know how that goes!! I have found a couple more things in the javascript that were not coded correctly. I have gotten passed the errors I requested your help on again Thank you!! Going forward and getting more errors of course. I'm going to try and work through them. Might need your assistance again.

Have a Great Day!!
Kelly
 

>> we bought the product

Them shouldn't you be asking the people you bought it from for support?

Don't get me wrong - I'm certainly not saying that you shouldn't ask for help wherever you need (forums, etc), but rather that the company who sold it should at least be informed that their product is buggy, and needs fixing, and I would have thought, provide a free-of-charge fix.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top