That makes sense. I have a list of pdf links that I want to track users clicking on, I'll worry about right clicking later :O), the function call works for onclick used with a button but not with the onclick of an a tag.
This seems to be because, as Rich and Duncan point out, the request gets sent before the function call and hence the .cfm page call. I don't want to stop the user from clicking through to the pdf, I only want to track them doing it. Returning true from the function would seem to be the answer but it still doesn't work :OS Any other ideas? Ade -----Original Message----- From: Rich Wild [mailto:[EMAIL PROTECTED] Sent: 14 October 2003 16:39 To: '[EMAIL PROTECTED]' Subject: RE: [ cf-dev ] Data piping possibly because the request is being sent before the script can complete - not sure. fix this by doing the following: <a href="somePDF.pdf" onclick="return someFunction();" /> and then have 'return true' as the final line of your function. > -----Original Message----- > From: Adrian Lynch [mailto:[EMAIL PROTECTED] > Sent: 14 October 2003 16:37 > To: '[EMAIL PROTECTED]' > Subject: RE: [ cf-dev ] Data piping > > > Too quick with my reply on this one. I have the call to the > function in the onclick of an <a> tag > > This works... > > <input type="button" name="myButton" value="Press Me" > onclick="someFunction();" /> > > but this doesn't... > > <a href="somePDF.pdf" onclick="someFunction();" /> > > Any ideas? > > Ade > > > -----Original Message----- > From: Adrian Lynch [mailto:[EMAIL PROTECTED] > Sent: 14 October 2003 16:07 > To: '[EMAIL PROTECTED]' > Subject: RE: [ cf-dev ] Data piping > > > Right then Peter, you've won yourself an all expenses paid > trip to an explanation as to why in the hell that works :OD > > Oh, and thank you as well :O) > > Ade > > -- Code that works -- > > <script> > function download() { > randomNumber = Math.random(); > pipeImage.src = > "http://somedomain.com/file.cfm?random=" + randomNumber; > }; > </script> > > -----Original Message----- > From: Peter Harrison [mailto:[EMAIL PROTECTED] > Sent: 14 October 2003 15:56 > To: [EMAIL PROTECTED] > Subject: RE: [ cf-dev ] Data piping > > > Would a varying request string force the re-request? > > ... > blah.src = "page.cfm?random=" + nRandomNumer; > ... > > - Peter > > > -----Original Message----- > From: Adrian Lynch [mailto:[EMAIL PROTECTED] > Sent: 14 October 2003 15:50 > To: Cfug Dev List (E-mail) > Subject: [ cf-dev ] Data piping > > > I'm trying to run a cfm page using the src attribute of an > image tag but for some reason, the change of source doesn't > cause the cfm page to be run. > > -- JavaScript Function -- > > function test() { > pipeImage.src = "page.cfm"; > > // also tried document.images["pipeImage"].src = "page.cfm"; > > // and creating a new image object in place of the above > } > > -- Image tag -- > <img name="pipeImage" src="../gif/trans.gif" /> > > -- Events -- > <a href="somewhere.cfm" onclick="test();" /> > or > <input type="button" name="myButton" value="press me" > onclick="test(); /> > > > If I call the cfm page straight away from an image tag > without any change to the src attribute I get the correct > update in the DB, but changing it in a function called via an > event doesn't seem to want to work. Does anyone have any > pointers on how to get this to work. > > I don't want any data passed back to the browser so setting > of cookies and then reading them as per some tutorials I've > read isn't needed. > > Thanks > > Ade > > ------------------------------------------------------------------ > Adrian Lynch > Web Application Developer > Thoughtbubble Ltd > Full Service Agency > ------------------------------------------------------------------ > <http://www.thoughtbubble.com> > Tel: +44 (0) 20 7387 8890 (ex. 23) > Fax: +44 (0) 20 7383 2220 > ------------------------------------------------------------------ > The information in this email and in any attachments is > confidential and intended solely for the attention and use of > the named addressee(s). Any views or opinions presented are > solely those of the author and do not necessarily represent > those of Thoughtbubble. This information may be subject to > legal, professional or other privilege and further > distribution of it is strictly prohibited without our > authority. If you are not the intended recipient, you are not > authorised to disclose, copy, distribute, or retain this > message. Please notify us on +44 (0)207 387 8890. > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] For human help, e-mail: > [EMAIL PROTECTED] > > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] For human help, e-mail: > [EMAIL PROTECTED] > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] For human help, e-mail: > [EMAIL PROTECTED] > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] For human help, e-mail: > [EMAIL PROTECTED] > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
