Re: javascript help
this works in Firefox on XP. not tested beyond that: script type=text/javascript for (var i=0; idocument.getElementsByTagName('a'); i++) { document.getElementsByTagName('a')[i].removeAttribute('href'); } /script On 9/28/07, Chad Gray [EMAIL PROTECTED] wrote: I am taking a page and sending it to CFDocument for a PDF. Is there a way to kill all hyper links on the page so there are no hyperlinks in the PDF? Thanks, Chad ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289746 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: javascript help
Chad Gray wrote: I am taking a page and sending it to CFDocument for a PDF. Is there a way to kill all hyper links on the page so there are no hyperlinks in the PDF? Why is this a Javascript question? Just do some regex fun on your output content, stripping all anchor tags, before writing it out to a PDF. ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289745 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: javascript help
hey guys i have a little window with a link on it opened up a popup window and gave it a name. the new window also has frames in it. I would like to manipulate the forms in that frame, like giving it certain values and stuff, by calling it from the little window. how do I do that? so far i am calling it as window.NEWWINDOWNAME. FRAMENAME.document.formname.inputformname.value but it gives me an object undefined error. help please! This is a CF Forum, not a JS forum, but here goes. When you launch the window, you must keep the launched window in a local var. Once you do that, you can access its frameset, etc... Below is an example of what I mean. script type=text/javascript var newWin; function openTheWindow() { newWin = window.open(launched.html,newWindowName); } function accessWindow() { alert(newWin.window.frames); } /script ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279455 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: javascript help
I believe that you have to reference the frame as an array index, similar to the way you can reference form elements. -Original Message- From: Dan Munez [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 9:12 AM To: CF-Talk Subject: OT: javascript help hey guys i have a little window with a link on it opened up a popup window and gave it a name. the new window also has frames in it. I would like to manipulate the forms in that frame, like giving it certain values and stuff, by calling it from the little window. how do I do that? so far i am calling it as window.NEWWINDOWNAME.FRAMENAME.document.formname.inputformname.value but it gives me an object undefined error. help please! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279456 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: javascript help
On Tuesday 29 May 2007, Andy Matthews wrote: I believe that you have to reference the frame as an array index, similar to the way you can reference form elements. Get firefox. Get the firebug extension. Set a break point and poke around the DOM :-) -- Tom Chiverton Helping to confidentially differentiate visionary models on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279463 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Javascript help
Well since we are being smart asses... the question was how can I clear either one when I click on any one of the radio buttons. One person's smart ass is another's stickler for accuracy. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264909 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
And here I was thinking you had no sense of humor ;-) -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Friday, December 22, 2006 10:43 AM To: CF-Talk Subject: RE: Javascript help Well since we are being smart asses... the question was how can I clear either one when I click on any one of the radio buttons. One person's smart ass is another's stickler for accuracy. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264912 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
On the radio button... Onclick=document.myform.mytextfield.value=''; If you are saying you want to clear both text fields Onclick=document.myform.mytextfield.value=''; document.myform.myothertextfield.value=''; -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:34 PM To: CF-Talk Subject: Javascript help I have a form with 2 text fields and some radio button, and what I would like to do is clear any text in the text fields if any of the radio buttons are selected. I can do this with one text field, but not sure how to work it with two This will work with one text field... input type=text name=Aquantity size=5 maxlength=6 cfif ClassAdDetails.quantity_option eq quantityvalue=#ClassAdDetails.AQuantity#/cfif input type=radio name=quantity_option value=always_in_stock onFocus=document.updClassified.Aquantity.value = '' But.Say just one of these text fields have a value, how can I clear either one when I click on any one of the radio buttons. input type=text name=name1 value=#value# input type=text name=name2 value=#value# input type=radio name=quantity_option value=always_in_stock onFocus=? input type=radio name=quantity_option value=always_in_stock onFocus=? input type=radio name=quantity_option value=always_in_stock onFocus=? Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264806 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript help
This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264808 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Javascript help
1. Don't use on focus, use on click. Users (well power users) and the disabled tab through form fields, and if you do on focus it will empty to form field even if they don't want to. 2. When dealing with multiple fields I would recommend your using a function in a script block kicked off by the onchange event. Example: html head titleJS Test/title script function clearForm(){ document.myForm.myField1.value=; document.myForm.myField2.value=; } /script /head body form name=myForm input type=text name=myField1 / input type=text name=myField2 / input type=radio name=myField3 onclick=return clearForm() / /form /body /html Also a couple of other tips. 1. Try and use XHTML. All attributes and tags need to be lower cased. 2. Only use pound signs when they are needed, same with parens. 3. DO NOT use camel case inside a tag unless your referencing a variable, everything else should be in lowers. 4. If you decide you don't want to create a function to handle this you can string statements together in the event handler using the semi-colon ; Example: input type=radio name=clearFormButton onclick=document.myForm.myField1.value=''; document.myForm.myField2.value=''; / One thing to be aware of with this is that you need to use different quotes, one for CF/HTML and one for JS. See you're declaring a string inside where your telling the object what event handler to run, or in this case writing the event handler on the tag. I use double quotes in tags, and singles in JS, it's a bit more difficult when you're creating dynamic SQL as you have to use the single quote. Anyway, hope it helps. -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:34 PM To: CF-Talk Subject: Javascript help I have a form with 2 text fields and some radio button, and what I would like to do is clear any text in the text fields if any of the radio buttons are selected. I can do this with one text field, but not sure how to work it with two This will work with one text field... input type=text name=Aquantity size=5 maxlength=6 cfif ClassAdDetails.quantity_option eq quantityvalue=#ClassAdDetails.AQuantity#/cfif input type=radio name=quantity_option value=always_in_stock onFocus=document.updClassified.Aquantity.value = '' But.Say just one of these text fields have a value, how can I clear either one when I click on any one of the radio buttons. input type=text name=name1 value=#value# input type=text name=name2 value=#value# input type=radio name=quantity_option value=always_in_stock onFocus=? input type=radio name=quantity_option value=always_in_stock onFocus=? input type=radio name=quantity_option value=always_in_stock onFocus=? Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264811 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
No it won't. For that you'll need a function and you'll need to write a javascript browser diction script and have separate clauses in the function for each browser. Mainly you'll use document.all and document.getElementById() -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:51 PM To: CF-Talk Subject: Re: Javascript help This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264814 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript help
That should work cross-browser, no? it's pretty standard JS syntax. onfocus=statement1; statement2; statement3... as long as each is separated by a semi-colon it should be ok? On 12/21/06, loathe [EMAIL PROTECTED] wrote: No it won't. For that you'll need a function and you'll need to write a javascript browser diction script and have separate clauses in the function for each browser. Mainly you'll use document.all and document.getElementById() -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:51 PM To: CF-Talk Subject: Re: Javascript help This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264818 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
You can stack arguments that way, but will calling the field that way work cross browser? I don't know, I still write it using different techniques. -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 4:09 PM To: CF-Talk Subject: Re: Javascript help That should work cross-browser, no? it's pretty standard JS syntax. onfocus=statement1; statement2; statement3... as long as each is separated by a semi-colon it should be ok? On 12/21/06, loathe [EMAIL PROTECTED] wrote: No it won't. For that you'll need a function and you'll need to write a javascript browser diction script and have separate clauses in the function for each browser. Mainly you'll use document.all and document.getElementById() -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:51 PM To: CF-Talk Subject: Re: Javascript help This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264822 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Javascript help
Also your using a comma and not a semi colon, sorry forgot to add that. -Original Message- From: loathe [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 4:07 PM To: CF-Talk Subject: RE: Javascript help No it won't. For that you'll need a function and you'll need to write a javascript browser diction script and have separate clauses in the function for each browser. Mainly you'll use document.all and document.getElementById() -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:51 PM To: CF-Talk Subject: Re: Javascript help This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264823 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Javascript help
i'm pretty sure it'll work. but of course i say that and invariably someone comes along and proves that it won't :) seriously tho. document.formname.fieldname.value is about as standard as it gets AFAIK. On 12/21/06, loathe [EMAIL PROTECTED] wrote: You can stack arguments that way, but will calling the field that way work cross browser? I don't know, I still write it using different techniques. -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 4:09 PM To: CF-Talk Subject: Re: Javascript help That should work cross-browser, no? it's pretty standard JS syntax. onfocus=statement1; statement2; statement3... as long as each is separated by a semi-colon it should be ok? On 12/21/06, loathe [EMAIL PROTECTED] wrote: No it won't. For that you'll need a function and you'll need to write a javascript browser diction script and have separate clauses in the function for each browser. Mainly you'll use document.all and document.getElementById() -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:51 PM To: CF-Talk Subject: Re: Javascript help This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264824 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript help
Check out jQuery. This sort of thing would be a snap in jQuery (http://jQuery.com). Doug Brown wrote: I have a form with 2 text fields and some radio button, and what I would like to do is clear any text in the text fields if any of the radio buttons are selected. I can do this with one text field, but not sure how to work it with two This will work with one text field... input type=text name=Aquantity size=5 maxlength=6 cfif ClassAdDetails.quantity_option eq quantityvalue=#ClassAdDetails.AQuantity#/cfif input type=radio name=quantity_option value=always_in_stock onFocus=document.updClassified.Aquantity.value = '' But.Say just one of these text fields have a value, how can I clear either one when I click on any one of the radio buttons. input type=text name=name1 value=#value# input type=text name=name2 value=#value# input type=radio name=quantity_option value=always_in_stock onFocus=? input type=radio name=quantity_option value=always_in_stock onFocus=? input type=radio name=quantity_option value=always_in_stock onFocus=? Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264825 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
Yes, it is as vanilla as it gets and easiest for most people to read and understand. But if you'd like to make it NOT work in all browsers that can read JS you can try some of these lol document.forms[0].myfield.value document.forms[0]['myfield'].value document.forms['myform'].myfield.value document.forms['myform']['myfield'] .value -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 4:23 PM To: CF-Talk Subject: Re: Javascript help i'm pretty sure it'll work. but of course i say that and invariably someone comes along and proves that it won't :) seriously tho. document.formname.fieldname.value is about as standard as it gets AFAIK. On 12/21/06, loathe [EMAIL PROTECTED] wrote: You can stack arguments that way, but will calling the field that way work cross browser? I don't know, I still write it using different techniques. -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 4:09 PM To: CF-Talk Subject: Re: Javascript help That should work cross-browser, no? it's pretty standard JS syntax. onfocus=statement1; statement2; statement3... as long as each is separated by a semi-colon it should be ok? On 12/21/06, loathe [EMAIL PROTECTED] wrote: No it won't. For that you'll need a function and you'll need to write a javascript browser diction script and have separate clauses in the function for each browser. Mainly you'll use document.all and document.getElementById() -Original Message- From: Doug Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 3:51 PM To: CF-Talk Subject: Re: Javascript help This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' Doug B. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264831 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Javascript help
document.formname.fieldname.value is about as standard as it gets AFAIK. Yes, it is as vanilla as it gets and easiest for most people to read and understand. But if you'd like to make it NOT work in all browsers that can read JS you can try some of these lol document.forms[0].myfield.value document.forms[0]['myfield'].value document.forms['myform'].myfield.value document.forms['myform']['myfield'] .value Actually, the first one in Bobby's list (document.forms[0].myfield.value) is the most compatible; it works in Netscape 2, while document.formname.myfield.value will not, if I recall correctly. Support for addressing forms (and elements) using array notation was introduced with the first version of JavaScript. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264839 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
so I asked said, You use WHAT browser? I dont consider Netscape 2 (or IE pre 5) when I use the phrase 'cross browser compatible'. Especially when dealing with JS and/or CSS. -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 5:42 PM To: CF-Talk Subject: RE: Javascript help document.formname.fieldname.value is about as standard as it gets AFAIK. Yes, it is as vanilla as it gets and easiest for most people to read and understand. But if you'd like to make it NOT work in all browsers that can read JS you can try some of these lol document.forms[0].myfield.value document.forms[0]['myfield'].value document.forms['myform'].myfield.value document.forms['myform']['myfield'] .value Actually, the first one in Bobby's list (document.forms[0].myfield.value) is the most compatible; it works in Netscape 2, while document.formname.myfield.value will not, if I recall correctly. Support for addressing forms (and elements) using array notation was introduced with the first version of JavaScript. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264842 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Javascript help
You can stack arguments that way, but will calling the field that way work cross browser? Yes, there's nothing wrong with having multiple statements within an event handler, other than readability. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264843 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Javascript help
This seems to work, but will it work in all browser? onFocus=document.updClassified.asking1.value = '',document.updClassified.asking2.value = '' No it won't. For that you'll need a function and you'll need to write a javascript browser diction script and have separate clauses in the function for each browser. Mainly you'll use document.all and document.getElementById() The original code would work fine, as long as the two statements are separated by semicolons, not commas. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264844 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
I don't consider Netscape 2 (or IE pre 5) when I use the phrase 'cross browser compatible'. Especially when dealing with JS and/or CSS. I thought the question was, what is the most compatible way to address a form in JS, not what browsers do you prefer to disregard? Right now, the answer to that question is to use the forms array. In XHTML 1.0, the FORM element should not even have a NAME attribute! (It's been deprecated.) http://www.w3.org/TR/xhtml1/#h-4.10 However, the HTML DOM still supports the forms array, and will do so for the foreseeable future: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-1689064 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264853 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript help
Well since we are being smart asses... the question was how can I clear either one when I click on any one of the radio buttons. -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 7:34 PM To: CF-Talk Subject: RE: Javascript help I don't consider Netscape 2 (or IE pre 5) when I use the phrase 'cross browser compatible'. Especially when dealing with JS and/or CSS. I thought the question was, what is the most compatible way to address a form in JS, not what browsers do you prefer to disregard? Right now, the answer to that question is to use the forms array. In XHTML 1.0, the FORM element should not even have a NAME attribute! (It's been deprecated.) http://www.w3.org/TR/xhtml1/#h-4.10 However, the HTML DOM still supports the forms array, and will do so for the foreseeable future: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-1689064 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264865 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript help
Hey Mike...you may have more luck on a list about technical issues and not CF-JOBS-TALK ;-) Bryan Stevenson B.Comm. VP Director of E-Commerce Development Electric Edge Systems Group Inc. phone: 250.480.0642 fax: 250.480.1264 cell: 250.920.8830 e-mail: [EMAIL PROTECTED] web: www.electricedgesystems.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:11:3029 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/11 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:11 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Javascript help
style should be handled as property: style2*.borderWidth* = '1px'; Mik Muller wrote: I'm trying to add some functionality to a stylesheet editor. I'd like the style that the editor is working on to highlight the page area it will effect. This is what I have, but it only works on style IDs and not CLASSes. How can I effect styles by class? Is there a way to temporarily replace the sheet value with an override while I mouse over an object? Thanks for any help in advance, Michael Here's a snippet of the style sheet: div.box_members { } div.box_members div.content { color:#00; background-color:#ace; } In the CF code: onmousedown=javascript:highlightLayer('div.box_members','border:3px dotted red;'); The JavaScript function: function highlightLayer(myAttribute,myStyle) { if (document.getElementById) { // this is the way the standards work var style2 = document.getElementById(myAttribute).style; style2 = style2? :myStyle; } else if (document.all) { // this is the way old msie versions work var style2 = document.all[myAttribute].style; style2 = style2? :myStyle; } else if (document.layers) { // this is the way nn4 works var style2 = document.layers[myAttribute].style; style2 = style2? :myStyle; } } Michael Muller Admin, MontagueMA.net Website work (413) 863-0030 cell (413) 320-5336 fax (518) 713-1569 skype: michaelBmuller email [EMAIL PROTECTED] http://www.MontagueMA.net Eschew Obfuscation ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:11:3030 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/11 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:11 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help
The onclicks are outside of the loop ..:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238272 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help
Bobby, I don't think they are, it might just parse weird for CFTalk... However, this is just sample code that I wrote in the email, so it might not be 100% accurate. But, in real test cases, when I do put the onclick I nthe FOR loop, they still all alert the same number. ... Ben Nadel www.bennadel.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 10:06 AM To: CF-Talk Subject: RE: Javascript help The onclicks are outside of the loop ...:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! . Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238274 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help
Maybe I'll get caffeine in me before I answer the next one. I'll take a closer look ;-) ..:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238275 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Javascript help
The loop is fine. It's difficult to see the braces in the text, but they're correct. Maybe you can't pass objects by value? You would think that, if it were possible, using the var keyword would ensure a new variable. On 4/20/06, Ben Nadel [EMAIL PROTECTED] wrote: Bobby, I don't think they are, it might just parse weird for CFTalk... However, this is just sample code that I wrote in the email, so it might not be 100% accurate. But, in real test cases, when I do put the onclick I nthe FOR loop, they still all alert the same number. ... Ben Nadel www.bennadel.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 10:06 AM To: CF-Talk Subject: RE: Javascript help The onclicks are outside of the loop ...:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! . Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238278 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help
Is this what you were going for? html body div id=mainContainer/div /body /html script for (IntI = 0; IntI 10; IntI++) { divCont = document.createElement('DIV'); divCont.id = 'div' + IntI; divCont.appendChild(document.createElement('BR')); divCont.style.background='ececec'; divCont.style.borderColor = '00'; divCont.style.borderStyle = 'solid'; divCont.style.borderWidth = '1px'; divCont.setAttribute('onClick', 'alert(' + IntI + ')'); document.getElementById('mainContainer').appendChild(divCont); document.getElementById('mainContainer').appendChild(document.createElement( 'BR')); } /script The onclick of the divs wont work in IE 6- ..:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238289 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help
PS... in your original code It's like they all point to one variable and then get updated for each loop of the FOR iteration They do. Each of your onclicks triggered the same function that alerted the same variable. The last time the variable was set, it was 10. So they are all 10. ..:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238290 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help
Bobby, I cannot seem to get the onCLick to fire in my browser. Granted I am using IE in Homesite. But, my concern with this solution is that I feel (without testing) that it is string dependent. divCont.setAttribute('onClick', 'alert(' + IntI + ')'); That line is going to try to force intI to a string, which works for simple values, but will not work with complex values. ... Ben Nadel www.bennadel.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 10:49 AM To: CF-Talk Subject: RE: Javascript help Is this what you were going for? html body div id=mainContainer/div /body /html script for (IntI = 0; IntI 10; IntI++) { divCont = document.createElement('DIV'); divCont.id = 'div' + IntI; divCont.appendChild(document.createElement('BR')); divCont.style.background='ececec'; divCont.style.borderColor = '00'; divCont.style.borderStyle = 'solid'; divCont.style.borderWidth = '1px'; divCont.setAttribute('onClick', 'alert(' + IntI + ')'); document.getElementById('mainContainer').appendChild(divCont); document.getElementById('mainContainer').appendChild(document.createElement( 'BR')); } /script The onclick of the divs wont work in IE 6- ...:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! . Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238292 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help
Gotcha, I just saw a couple other posts that got separated into another thread that explained that. I'll try it again in a few. ..:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 11:01 AM To: CF-Talk Subject: RE: Javascript help Bobby, I cannot seem to get the onCLick to fire in my browser. Granted I am using IE in Homesite. But, my concern with this solution is that I feel (without testing) that it is string dependent. divCont.setAttribute('onClick', 'alert(' + IntI + ')'); That line is going to try to force intI to a string, which works for simple values, but will not work with complex values. Ben Nadel www.bennadel.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 10:49 AM To: CF-Talk Subject: RE: Javascript help Is this what you were going for? html body div id=mainContainer/div /body /html script for (IntI = 0; IntI 10; IntI++) { divCont = document.createElement('DIV'); divCont.id = 'div' + IntI; divCont.appendChild(document.createElement('BR')); divCont.style.background='ececec'; divCont.style.borderColor = '00'; divCont.style.borderStyle = 'solid'; divCont.style.borderWidth = '1px'; divCont.setAttribute('onClick', 'alert(' + IntI + ')'); document.getElementById('mainContainer').appendChild(divCont); document.getElementById('mainContainer').appendChild(document.createElement( 'BR')); } /script The onclick of the divs wont work in IE 6- :.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 9:35 AM To: CF-Talk Subject: OT: Javascript help Not really for CF, but though someone here could lend some insight There is one problem in Javascript that I cannot seem to get a handle on and it is killling me! I can't seem to get variables to pass by value as I would hope. Take the following example: for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = function(){ alert( intI ); }; // Set the link into the body div. objDiv.appendChild( objA ); } Now, in my head, each one of those links, when clicked should alert the appropriate intI value (0, 1, 2, 3, etc.); however, each of them will alert 10 which is the value that broke the FOR loop. It's like they all point to one variable and then get updated for each loop of the FOR iteration. I can't seem to find a good solution to this. One method that seems to work, but is poop is something along the lines of: // Define a function INSIDE this function. function GetI( intX ){ return( function(){ alert(intX); }; ); } for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); // Set the click for the link. objA.onclick = GetI( intX ); // Set the link into the body div. objDiv.appendChild( objA ); } This method works as would be expected, though I seem to think that it is doing the exact same thing. It must be something to do with the scoping. Since the intI value is getting passed to a local scope (int GetI()), and then getting passed back, it must be unique (since the local scope of the GetI() method is created unique of each FOR iteration. This solution seems truly ganky to me. There has to be a better way. And this is just a simple example. I have many places where I want to be doing this with object reference and dynamic event handling. This one simple bumb is really holding me back! Please help!!! .. Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238311 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help.
function selTA() { document.formname.fieldname.focus(); } window.onload = selTA; ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: J W [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:24 PM To: CF-Talk Subject: OT: Javascript help. I have been beating my head around for the better part of today trying to figure this out.. I am prefilling a textarea with some information. When the page loads, I would like to set focus to the text area and have the cursor position set to the first character in the textarea with the prefilled info. Is this even possible or am I just missing something stupid. I have scoured google to no avail... Thanks, Jeff ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226266 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help.
Hmmm guess that only places the cursor at the beginning in IE... gimmee a minute :) ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:31 PM To: CF-Talk Subject: RE: Javascript help. function selTA() { document.formname.fieldname.focus(); } window.onload = selTA; ...:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: J W [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:24 PM To: CF-Talk Subject: OT: Javascript help. I have been beating my head around for the better part of today trying to figure this out.. I am prefilling a textarea with some information. When the page loads, I would like to set focus to the text area and have the cursor position set to the first character in the textarea with the prefilled info. Is this even possible or am I just missing something stupid. I have scoured google to no avail... Thanks, Jeff ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226268 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Javascript help.
This should do it. script type=text/javascript function selTA() { document.myform.myfield.focus(); document.myform.myfield.selectionStart=0; document.myform.myfield.selectionEnd=0; } window.onload = selTA; /script ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:38 PM To: CF-Talk Subject: RE: Javascript help. Hmmm guess that only places the cursor at the beginning in IE... gimmee a minute :) ...:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:31 PM To: CF-Talk Subject: RE: Javascript help. function selTA() { document.formname.fieldname.focus(); } window.onload = selTA; :.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: J W [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:24 PM To: CF-Talk Subject: OT: Javascript help. I have been beating my head around for the better part of today trying to figure this out.. I am prefilling a textarea with some information. When the page loads, I would like to set focus to the text area and have the cursor position set to the first character in the textarea with the prefilled info. Is this even possible or am I just missing something stupid. I have scoured google to no avail... Thanks, Jeff ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226272 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Javascript help.
Well thats interesting, I have been testing in Firefox all day. S I fired up the code in IE and noticed a difference. IE. Works just fine. Cusor at Top Firefox. Focus is set, but cursor is set at the end of text. So focus alone doesn't gurantee that the cursor will be at the beginning of the text cross browser. Intersting. Thats why I was wondering if there was a way to specifically set the position. Jeff On 12/6/05, Bobby Hartsfield [EMAIL PROTECTED] wrote: function selTA() { document.formname.fieldname.focus(); } window.onload = selTA; ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: J W [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:24 PM To: CF-Talk Subject: OT: Javascript help. I have been beating my head around for the better part of today trying to figure this out.. I am prefilling a textarea with some information. When the page loads, I would like to set focus to the text area and have the cursor position set to the first character in the textarea with the prefilled info. Is this even possible or am I just missing something stupid. I have scoured google to no avail... Thanks, Jeff ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226276 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Javascript help.
Worked like a charm! Thanks much. Jeff On 12/6/05, Bobby Hartsfield [EMAIL PROTECTED] wrote: This should do it. script type=text/javascript function selTA() { document.myform.myfield.focus(); document.myform.myfield.selectionStart=0; document.myform.myfield.selectionEnd=0; } window.onload = selTA; /script ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:38 PM To: CF-Talk Subject: RE: Javascript help. Hmmm guess that only places the cursor at the beginning in IE... gimmee a minute :) ...:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:31 PM To: CF-Talk Subject: RE: Javascript help. function selTA() { document.formname.fieldname.focus(); } window.onload = selTA; :.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: J W [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 2:24 PM To: CF-Talk Subject: OT: Javascript help. I have been beating my head around for the better part of today trying to figure this out.. I am prefilling a textarea with some information. When the page loads, I would like to set focus to the text area and have the cursor position set to the first character in the textarea with the prefilled info. Is this even possible or am I just missing something stupid. I have scoured google to no avail... Thanks, Jeff ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226281 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: JAVASCRIPT help
Keep in mind the value property of a select is not supported on all browsers. I usually consider a textbox/textarea empty if there are only spaces (I usually trim the values anyway. Also keep in mind that title and target are properties of the form. To avoid mixing up formfields and properties, I always have the formfield names in uppercase (JS is case sensitive). Finally, you can set the focus on the field that has an error to help your user fill in the form. Pascal SCRIPT LANGUAGE=_javascript_ TYPE=text/_javascript_ !-- function Validate(f){ var blank_pattern = /^\s*$/i; if(blank_pattern.test(f.TITLE.value)){ alert(Title is required); f.TITLE.select(); f.TITLE.focus(); return false; } if(blank_pattern.test(f.STORY.value)){ alert(Story is required); f.STORY.select(); f.STORY.focus(); return false; } var selectedVal = (f.TARGET.options[f.TARGET.selectedIndex].value!=); if(blank_pattern.test(f.LINK.value)selectedVal){ alert(You must provide a link if you select a target); f.LINK.select(); f.LINK.focus(); return false; } if(!blank_pattern.test(f.LINK.value)!selectedVal){ alert(You must select a target if you provide a link); f.TARGET.focus(); return false; } return true; } //-- /SCRIPT form ... Validate(this) -Original Message- From: Asim Manzur [mailto:[EMAIL PROTECTED] Sent: maandag 28 juni 2004 22:47 To: CF-Talk Subject: Re: _javascript_ help Thanks Mike, That works great. What if the user change the value of the target from to _self or _blank then I need to display the msg to put the Link as well. thanks [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: JAVASCRIPT help
function checkForm() { var title= document.myForm.title.value; var story= document.myForm.story.value; var link= document.myForm.link.value; var target= document.myForm.target.value; var fbString = ''; if (title == '') fbString = fbString + You must enter a title\n; if (story == '') fbString = fbString + You must enter a story\n; if (link != '' target == '') fbString = fbString + You must enter a target for your link\n; if (fbString != '') { alert(fbString); return false; } else { return true; } } ...and in your form form name=myForm method=get action="" checkForm(); -mike Asim Manzur [EMAIL PROTECTED] 06/28/2004 03:30 PM Please respond to cf-talk To:CF-Talk [EMAIL PROTECTED] cc: Subject:_javascript_ help Can someone give me a hand on _javascript_ validation? I have a formwith the following fields titletextbox story textarea linktextbox target select boxwith the value of _self _blank and What I want that TITLE and STORY should not be empty and if something in the link then target sould not be empty Will appriciate that Regards, Asim Manzur [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: JAVASCRIPT help
Thanks Mike, That works great. What if the user change the value of the target from to _self or _blank then I need to display the msg to put the Link as well. thanks [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Javascript Help Required
You have a Syntax error... You missed the double quotes on the first image. b1.src = ""> From: Shahzad.Butt [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Subject: _javascript_ Help Required Date: Tue, 30 Dec 2003 11:40:34 - Hi I am using following script to change the image for a button on mouseOver (red button) and mouseOut (white button). What I can not achieve or I dont know how to do is when link is active then display image which I am using on mouseOver script language=_javascript_ if (browserVer == 1) { b1 = new Image(107,36); b1.src = ""> b2 = new Image(107,36); b2.src = ""> } //image swapping function: function hiLite(imgDocID, imgObjName, comment) { if (browserVer == 1) { document.images[imgDocID].src = "" + .src); window.status = comment; return true; }} //end hiding -- /script Thats where I am using the function in CF A Login') Login') href="" target=Right class=sml img border=0 name=b src=""> Can anyone explain me when a link is active how can I keep the Redbutton not the white one?? Shahzad.Butt Ph:+44 (0) 1992 701 722 Fax: +44 (0) 1992 701 604 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Javascript Help Required
That must be a mistake writing email however my code works fine. Only problem is that I dont know how to keep the image active (Red One) when a link is active. _ From: MILAN MUSHRAN [mailto:[EMAIL PROTECTED] Sent: 30 December 2003 14:10 To: CF-Talk Subject: RE: _javascript_ Help Required You have a Syntax error... You missed the double quotes on the first image. b1.src = ""> From: Shahzad.Butt [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Subject: _javascript_ Help Required Date: Tue, 30 Dec 2003 11:40:34 - Hi I am using following script to change the image for a button on mouseOver (red button) and mouseOut (white button). What I can not achieve or I dont know how to do is when link is active then display image which I am using on mouseOver script language=_javascript_ if (browserVer == 1) { b1 = new Image(107,36); b1.src = ""> b2 = new Image(107,36); b2.src = ""> } //image swapping function: function hiLite(imgDocID, imgObjName, comment) { if (browserVer == 1) { document.images[imgDocID].src = "" + .src); window.status = comment; return true; }} //end hiding -- /script Thats where I am using the function in CF A Login') Login') href="" target=Right class=sml img border=0 name=b src=""> Can anyone explain me when a link is active how can I keep the Redbutton not the white one?? Shahzad.Butt Ph:+44 (0) 1992 701 722 Fax: +44 (0) 1992 701 604 _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
MY BAD! - RE: JavaScript Help Required
This is to the _javascript_ problem, _javascript_ Help Required Sorry for the accidental thread start [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Javascript Help
test,test1,test2,test3.split(',') will create an array -Original Message- From: Andrew Scott [mailto:[EMAIL PROTECTED] Sent: Friday, 19 December 2003 3:03 p.m. To: CF-Talk Subject: _javascript_ Help Looking for any help in being able to do the following. I am looking at a string test,test1,test2,test3, and what I would like to do is get the value of these from the form variable sounds simple enough. But how to I get the item out of the string using _javascript_. In coldfusion I would used ListGetAt, but I can't seem to find anything in JS to do this. Regards Andrew Scott Technical Consultant NuSphere Pty Ltd Level 2/33 Bank Street South Melbourne, Victoria, 3205 Phone: 03 9686 0485-Fax: 03 9699 7976 _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Javascript Help
I would use the function called split() which makes an array based on a delimiter passed in (in your case the comma). Then you can loop over the array or access the elements as you need: var x = 'test1,test2,test3,test4'; arElements = x.split(','); would result in... arElements[0] = 'test1' arElements[1] = 'test2' arElements[2] = 'test3' arElements[3] = 'test4' HTH, Mike _ From: Andrew Scott [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 10:03 PM To: CF-Talk Subject: _javascript_ Help Looking for any help in being able to do the following. I am looking at a string test,test1,test2,test3, and what I would like to do is get the value of these from the form variable sounds simple enough. But how to I get the item out of the string using _javascript_. In coldfusion I would used ListGetAt, but I can't seem to find anything in JS to do this. Regards Andrew Scott Technical Consultant NuSphere Pty Ltd Level 2/33 Bank Street South Melbourne, Victoria, 3205 Phone: 03 9686 0485-Fax: 03 9699 7976 _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Javascript Help
Thanks works a treat Regards Andrew Scott Technical Consultant NuSphere Pty Ltd Level 2/33 Bank Street South Melbourne, Victoria, 3205 Phone: 03 9686 0485-Fax: 03 9699 7976 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: JavaScript Help - PLEASE!
I'm in a bit of a quandary here, and was hoping that some if the brilliant minds on this list could offer some insight. CF_SNIP Questions: Is there any way to spoof the DOM into thinking that the first form on the page is document.form[100]? (Can you override how the DOM indexes objects in a page?) Is there another way to work around this? The problem is that the standard DOM counts forms from zero, do you'd have to add 99 more forms in to get them to recognise it as document.form[100] Overall, the simplest solution is to name the form and call it by name Philip Arnold Technical Director Certified ColdFusion Developer ASP Multimedia Limited Switchboard: +44 (0)20 8680 8099 Fax: +44 (0)20 8686 7911 www.aspmedia.co.uk www.aspevents.net An ISO9001 registered company. ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: javascript help
script language=javascript function populateHiddenField(){ document.forms[0].hTEXT.value = whatever; } form action=myPage.cfm method=post onClick=return populateHiddenField(); Douglas Brown Email: [EMAIL PROTECTED] - Original Message - From: Corey Yiap [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, July 18, 2002 3:01 AM Subject: javascript help I'm a newbie, how would I pass a value to a hidden field? For example, I have a form call FOO and the hidden text field is hTEXT, how would I write a onClick=javascript: ?? ? __ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: javascript help
Thanks Doug -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 18, 2002 3:07 AM To: CF-Talk Subject: Re: javascript help script language=javascript function populateHiddenField(){ document.forms[0].hTEXT.value = whatever; } form action=myPage.cfm method=post onClick=return populateHiddenField(); Douglas Brown Email: [EMAIL PROTECTED] - Original Message - From: Corey Yiap [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, July 18, 2002 3:01 AM Subject: javascript help I'm a newbie, how would I pass a value to a hidden field? For example, I have a form call FOO and the hidden text field is hTEXT, how would I write a onClick=javascript: ?? ? __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: javascript help
no prob, but should have been input type=submit onclick=return populateHiddenField(); instead of onClick in the formtoo early in the morning to think, about 4.5 hours past my bedtime Douglas Brown Email: [EMAIL PROTECTED] - Original Message - From: Corey Yiap [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, July 18, 2002 3:12 AM Subject: RE: javascript help Thanks Doug -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 18, 2002 3:07 AM To: CF-Talk Subject: Re: javascript help script language=javascript function populateHiddenField(){ document.forms[0].hTEXT.value = whatever; } form action=myPage.cfm method=post onClick=return populateHiddenField(); Douglas Brown Email: [EMAIL PROTECTED] - Original Message - From: Corey Yiap [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, July 18, 2002 3:01 AM Subject: javascript help I'm a newbie, how would I pass a value to a hidden field? For example, I have a form call FOO and the hidden text field is hTEXT, how would I write a onClick=javascript: ?? ? __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Javascript help
In your action page (Frame 2) .. Cold fusion code ... scriptparent.framename.formname.fieldname.value='whatever';/script Or something very similar ... I didn't check the syntax, but that should give you a start. Joshua Miller Web Development :: Programming Eagle Web Development LLC www.eaglewd.com [EMAIL PROTECTED] (304) 622-5676 (Clarksburg Office) (304) 456-4942 (Home Office) -Original Message- From: Kris Pilles [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 02, 2002 11:25 AM To: CF-Talk Subject: OT: Javascript help I need som help with Frames and javascript... I want to make a form field in frame zero to become active when my login is completed in frame 2 Please help -Original Message- From: peter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 02, 2002 11:03 AM To: CF-Talk Subject: setdomaincookies = yes Hi, Normally I'm including this code to delete session variabeles when closing the browser: cflock timeout=5 throwontimeout=Yes type=READONLY scope=SESSION cfcookie name=CFID value=#session.CFID# cfcookie name=CFTOKEN value=#session.CFTOKEN# /cflock But when you set setDomainCookies=yesin your cfapplication, the cookies are not deleted when closing the browser. Anyone have the same experience / workaround? Peter __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Javascript Help
d=new Date(); alert(d); d.setHours(d.getHours()+5); alert(d); - Original Message - From: clint [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, January 10, 2002 11:35 AM Subject: OT: Javascript Help I know this is off topic, but it kinda isn't. Can someone show me how to add 5 minutes to now in javascript? I am having a hard time finding how to do this. Thanks! __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: JavaScript Help
How do I get JavaScript to evaluate tdID into its true value and not think that I'm refering to an object named tdID? I recommend to anyone that uses javascript in there applications to join the JS-Jive mailing list (just send a blank email to [EMAIL PROTECTED]). The list has over 900 members and a lot of CF programmers as well. It was started by a long time member of this list (me). It has proven to be an invaluable resource for Javascript questions. The home page for the group is at http://groups.yahoo.com/group/JS-Jive. HTH, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: JavaScript Help...
Use Window.Open window.open(URL,Name,Param) eg... a href=## onClick="javascript:win('more.cfm?id=#primarykey_id#','lookup','scrollbars=y es,width=650,height=500')"Click Me!/a -- Gavin Lilley Internet / Intranet Developer Halesowen College Tel: 0121 550 1451 Ext: 330 -Original Message- From: Neil H. [mailto:[EMAIL PROTECTED]] Sent: 03 October 2000 16:36 To: CF-Talk Subject: Javascript Help... I would like to pop a window via a javascript. This isn't a problem, I know how to pop a window. I don't want a toolbar and I want it to be a specific size. The problem is I want to pass form parameters to the page when I pop the window. I don't want to have url parameters. Any ideas would be "bloody marvolous" Thanks, Neil p.s. That quote is from Lethal Weapon 4 :) -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Javascript Help...
Neil, Ok, I dont have a code sample on hand but here is the process... 1. create a form on the original window with hidden variables of all the values you wish to pass, make sure the form has a name and a target set... 2. when you have the trigger action that is going to create the window, create the window with no source document or a blank page and then still in the source window function do a submission of the form created in step 1 that has a target set to the name of the popup window... I think that will work, just something off the top of my head HTH, John -Original Message- From: Neil H. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 03, 2000 10:36 AM To: CF-Talk Subject: Javascript Help... I would like to pop a window via a javascript. This isn't a problem, I know how to pop a window. I don't want a toolbar and I want it to be a specific size. The problem is I want to pass form parameters to the page when I pop the window. I don't want to have url parameters. Any ideas would be "bloody marvolous" Thanks, Neil p.s. That quote is from Lethal Weapon 4 :) -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Javascript Help...
I would like to pop a window via a javascript. This isn't a problem, I know how to pop a window. I don't want a toolbar and I want it to be a specific size. The problem is I want to pass form parameters to the page when I pop the window. I don't want to have url parameters. Any ideas would be "bloody marvolous" Neil, Just pop up a window first (doesn't need a URL, just a name), then your form should use the same name as its target parameter. (Forms can be targeted to windows just like anchor tags can be.) However, if you test with IE4, you'll discover a well-known bug where IE cannot submit a form to an already-created popup window, so it's best to sniff the browser, and NOT pre-open the popup for IE4... just let it open its own window of the same name. Hope that gets you started... -Ron -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Javascript Help...
Yeah, But if I do it that way how can I pop a window and send form parameters and the window not have a tool bar? neil - Original Message - From: [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Tuesday, October 03, 2000 12:01 PM Subject: RE: Javascript Help... I would like to pop a window via a javascript. This isn't a problem, I know how to pop a window. I don't want a toolbar and I want it to be a specific size. The problem is I want to pass form parameters to the page when I pop the window. I don't want to have url parameters. Any ideas would be "bloody marvolous" Neil, Just pop up a window first (doesn't need a URL, just a name), then your form should use the same name as its target parameter. (Forms can be targeted to windows just like anchor tags can be.) However, if you test with IE4, you'll discover a well-known bug where IE cannot submit a form to an already-created popup window, so it's best to sniff the browser, and NOT pre-open the popup for IE4... just let it open its own window of the same name. Hope that gets you started... -Ron -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Javascript Help...
From the popup, to change the location (or a variable or whatever) of the calling page you would use: // changes the location of the page that opened this popup window.opener.location.href="abc.html"; // changes a variable/object 'X' in the page that opened this popup window.opener.X="New Value"; From the calling page, to change the location (or a variable or whatever) of the popup you would use: // opens the popup x=window.open('popup.html','title','width=123,height=456'); // changes the location of the popup x.location.href="abc.html"; // changes a variable/object 'X' in the popup x.X="New Value"; -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: javascript help
I'm trying to develop a javascript validation for a textarea. I'm getting an error message which says "ProgramDescription.value" is not an object. === script language="javascript1.2" function validate(testform) { if (testform.ProgramDescription.value == " ") { window.alert("Please add a program description."); return false; } return true; } /script cfform action="AddNewProgram.cfm" method="post" ONSUBMIT="return validate(this)" textarea name="ProgramDescription" value="" cols="30" rows="10" wrap="virtual"/textarea input type="submit" value="submit" /cfform ... I found out that you can't really combine the ColdFusion form validation of cfinput with other javascripts validation. I mean there is not built in textarea CF validation. So I used an independent javascript validation for the textarea along with the CF built in validation and the independent javascript validating the textarea does not work. Probably has to do with CF assigning another name to the form. How do you validate a textarea with javascript along with using the built in CF javascript validation with other form elements? You can do this by simply writing a JavaScript function that validates your field and returns true or false as appropriate, then reference that function in your CFFORM tag's ONSUBMIT attribute, as your original code sample does. You don't need to specify a NAME attribute for your CFFORM tag; CF will do this automatically for you (the default name will be "CFForm_1", I think). There are two problems with your original code sample. One is that you've specified a VALUE attribute for your TEXTAREA, but that's not how the TEXTAREA tag works. Here's an example: textarea name="foo"This string is the value/textarea The other problem is that the ONSUBMIT attribute of CFFORM doesn't work the same way as it would for an HTML form. When CF sees that, it takes the string value you've specified and writes it into a wrapper function, which gets created automatically by CFFORM. This wrapper function is what CFFORM uses to call all of its own validation routines, and it will be in the document head. It'll look like this: script LANGUAGE=JAVASCRIPT TYPE="text/javascript" !-- function _CF_checkCFForm_1(_CF_this) { return validate(testform); return true; } //-- /script Of course, at this point the problem should be obvious. The "this" keyword that you were expecting to reference the form won't be used inside this wrapper function. To avoid this problem, simply use an explicit reference within your validation function: if (document.forms[0].ProgramDescription.value == "") ... Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: javascript help
Your cfform needs a name. If you're just using HTML forms, you'll still need a name for your form to access the form's contents. -- Jamie Keane Programmer SolutionMasters, Inc. 9111 Monroe Rd., Suite 100 Charlotte, NC 28270 www.solutionmasters.com 704.563.5559 x 228 Voice 704.849.9291 Fax -Original Message- From: sebastian palmigiani [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Thursday, August 17, 2000 1:50 PM Subject: javascript help I'm trying to develop a javascript validation for a textarea. I'm getting an error message which says "ProgramDescription.value" is not an object. === script language="javascript1.2" function validate(testform) { if (testform.ProgramDescription.value == " ") { window.alert("Please add a program description."); return false; } return true; } /script cfform action="AddNewProgram.cfm" method="post" ONSUBMIT="return validate(this)" textarea name="ProgramDescription" value="" cols="30" rows="10" wrap="virtual"/textarea input type="submit" value="submit" /cfform Thanks, Sebastian --- --- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: javascript help
I found out that you can't really combine the ColdFusion form validation of cfinput with other javascripts validation. I mean there is not built in textarea CF validation. So I used an independent javascript validation for the textarea along with the CF built in validation and the independent javascript validating the textarea does not work. Probably has to do with CF assigning another name to the form. How do you validate a textarea with javascript along with using the built in CF javascript validation with other form elements? Sebastian on 8/17/00 12:57 PM, Jamie Keane at [EMAIL PROTECTED] wrote: Your cfform needs a name. If you're just using HTML forms, you'll still need a name for your form to access the form's contents. -- Jamie Keane Programmer SolutionMasters, Inc. 9111 Monroe Rd., Suite 100 Charlotte, NC 28270 www.solutionmasters.com 704.563.5559 x 228 Voice 704.849.9291 Fax -Original Message- From: sebastian palmigiani [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Thursday, August 17, 2000 1:50 PM Subject: javascript help I'm trying to develop a javascript validation for a textarea. I'm getting an error message which says "ProgramDescription.value" is not an object. === script language="javascript1.2" function validate(testform) { if (testform.ProgramDescription.value == " ") { window.alert("Please add a program description."); return false; } return true; } /script cfform action="AddNewProgram.cfm" method="post" ONSUBMIT="return validate(this)" textarea name="ProgramDescription" value="" cols="30" rows="10" wrap="virtual"/textarea input type="submit" value="submit" /cfform Thanks, Sebastian --- --- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.