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!

NEED SOME HELP?! JAVA SCRIPT NOT WORKING

Status
Not open for further replies.

CF7

Programmer
May 22, 2007
1
US
i am expericing some problems with this embedded JS in Coldfusion. i keep getting a syntax error and dont understand why
--------------------------------------------------------------
<a href="javascript:void(0)"
onclick='clicked()'> #dirList.name# </a><br />

<script language="javascript">
function clicked()
{

window.parent.document.getElementById("fileD").value="#replace(dirList.directory,'\','\\','ALL')#\\#dirList.name#";
<!--- document.getElementById("fileLink").style.color="50141E"; --->
window.parent.document.getElementById("bC").disabled="true";
document.write("A file has been set. to remove it please click <a href='javascript:void(0)' onclick='window.parent.document.getElementById('fileD').value='null'; window.parent.document.getElementById('bC').disabled='false'; window.location.href='#cgi.SCRIPT_NAME#';'> here </a> , otherwise click <strong>submit</strong> to continue.");

}
 
Hi

The disabled property is boolean, not string.
Code:
window.parent.document.getElementById("bC").disabled=true
But probably the problem is not that.
CF7 said:
i keep getting a syntax error
What syntax error ?

And please arrange your code abit to be easier to read. And enclose it between [tt][ignore]
Code:
[/ignore][/tt] and [tt][ignore]
[/ignore][/tt] tags.

Feherke.
 
Without seeing the real CLIENT-SIDE code, it would be impossible to guess. The code you've posted is NOT client-side, and is riddled with syntax errors.

However, chances are that most, if not all of these would be parsed out when delivered to the browser, so you'll have to show us that, or we've nothing to go on.

One error I can see, however, is the use of HTML comments inside a JS script block. Replace these and see if the error goes away.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi

Dan, personally I think you are right about the HTML comment inside the [tt]script[/tt] tags. But seems that browsers does not bother to yell because that. I tried this and both [tt]alert()[/tt]s appeared.
JavaScript:
<script language="javascript">
function clicked()
{
  alert('before');
  <!--- document.getElementById("fileLink").style.color="50141E"; --->
  alert('after');
}
</script>
Tested in FireFox, Opera and Explorer. None objected. Not even a warning in the JavaScript Console. Neither in XHTML Strict ( added [tt]type[/tt] attribute and removed third dashes to validate ).

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top