It's somewhat easy to (in a roundabout way) have Javascript affect a ColdFusion page ... trouble is, the others have been right. You need to submit a form to do so.
In a content management system I'm just finishing, I just this evening cobbled together a browser detection script which determined if my once-you're-logged-in CF page should use certain DOM goodies or not. The script in the login page's <head></head> is:
[COLOR=880000]
<script language="JavaScript" type="text/javascript">
<!--
var n4 = (document.layers) ? 1 : 0;
var ie = (document.all) ? 1 : 0;
var dom;
var browser = (navigator.appVersion.indexOf("MSIE"

>= 0) ? 1 : 0;
if (n4 == 1) {dom = 0}
else {
if (navigator.userAgent.indexOf("MSIE 4"

== -1){
(document.getElementsByTagName("*"

) ? (dom = 1) : (dom = 0)
}
}
[COLOR=ff0000]
function testbrowser() {
if ((dom == 1)&&(browser == 1)) {
document.write('<input type="hidden" name="DOMtest" value="yes" />')
}
else {
document.write ('<input type="hidden" name="DOMtest" value="no" />')
}
}
[/color]
//-->
</script>[/color]
[COLOR=555555](The above script pretty much tests for the IE5+. Lest you harangue me for being a Microsoft exclusivist, this actually allows the app to be fully functional in all browsers. You'll see how in a moment ...)[/color]
Then the login form contains this part:
[COLOR=880000]
<form action="index.cfm?choice=login" method="post">
...other form elements ...
[COLOR=ff0000]
<script language='javascript' type='text/javascript'>
<!--
testbrowser()
//-->
</script>[/color]
<input type="submit" value="Log in" />
</form>[/color]
As you've probably figured out, the JS in the head determines which hidden form element to add to the form. That value (either "yes" or "no"

then gets used in the page that the form submits to:
[COLOR=008800]
<cfif form.DOMtest is "yes">
<p class="confirmation">You're in and DOM-enabled.</p>
<cfset session.DOM = "true">
<cfelse>
<p class="error">No DOM for you.</p>
<cfset session.DOM = "false">
</cfif>[/color]
Ta-da: a Javascript function affects a following CF page.
[COLOR=555555](Oh yeah, the "why test for IE5+?" question. With some of the DOM-interacting-with-CSS stuff I did, all versions of Netscape [even 6.2] and older IE just didn't respond, which made certain necessary form and page editing elements unusable. Thus I'm putting some <cfif>s around those DOM bits: if it's a DOM-OK browser, then it'll get the cool little interactive CSS trickeries; if it's not, then it'll just get the form/editing elements without any fuss. Make sense?)[/color]