Not tested... but possibly because you are calling an onclick event and
also using _javascript_ in the href tag?  Confusing the useragent?

Could spin it off into a function of its own.... something like...

function doAction(formNo) {
var theForm = eval("document.PageSwitch"&formNo);

//Debug output... all should return an object (although the
submit may choke ;-)
//alert(theForm);
//alert(theForm.Action);
//alert(theForm.submit);

theForm.Action.value = 'dispalyProducts';
theForm.submit();
}

Then call it in your code like.....
<a href="" doAction('1');">#ThisPage#</a>

You could also do testing... ie the error messages you are recieveing
are saying that they are not objects... validate your HTML and test by
calling alert(document.PageSwitch1) or
alert(document.PageSwitch2.Action)..., you should get an [object]
back.....

Sorry bit rusty on the _javascript_ ... the code above may need jiggled a
little bit to work....

Only thing I can think of at the moment....

--
-dc  [ cf5, ora8.1.7, iis5 ]

-----Original Message-----
From: Che Vilnonis [mailto:[EMAIL PROTECTED]
Sent: 08 December 2003 17:20
To: CF-Talk
Subject: I could use a JS expert right now.

Here is a code snippet from a page the is similar to the bottom of a
google.com results page. I'm trying to use dynamic forms instead of long
URLs to go from page to page. Assume my CF code is correct. My use of
_javascript_ is bombing out. What am I doing wrong? See below.

      Result Page:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      Next


<cfloop index="ThisPage" from="1" to="#NumPages#">

<form name="PageSwitch#ThisPage#"
action=""> method="Post">
<input type="hidden" name="Level" value="#Attributes.Level#"> <input
type="hidden" name="StartRow" value="#Attributes.PageNumberStart#">
<input type="hidden" name="PageNumber" value="#ThisPage#"> <input
type="hidden" name="Action"> <td class="generictext"><a
> href=""> #ThisPage#';return true"
true">#ThisPage#</a>&nbsp;</td>
</form>

</cfloop>

The JS errors read:
- Error: document.PageSwitch2.Action has no properties
and - Error: document.PageSwitch2.submit is not a function. Source File:
_javascript_:document.PageSwitch2.submit();

Thanks Che
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to