(ot) Javascript Help
Ok, I need some Javascript help. I just cannot get this script (residing in an iframe)... script parent.thisMovie('studio_loader_embed').reloadClipart(); parent.thisMovie('studio_loader_embed').showTab(2); /script ...to go through this script... script function thisMovie(movieName) { if (navigator.appName.indexOf(Microsoft) != -1) { return HTMLCollection.namedItem(movieName) } else { return document[movieName] } } /script ...to function on this object... div style=margin:0px; padding:5px; width:670px; float:left; object classid=clsid:d27cdb6e-ae6d-11cf-96b8-44455354 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0; width=670 height=550 param name=allowScriptAccess value=sameDomain / param name=allowFullScreen value=false / param name=movie value=/flash/studio_loader.swf?urlvars=1264,0,0,0,0,0 / param name=quality value=high / param name=bgcolor value=white / embed src=/flash/studio_loader.swf?urlvars=1264,0,0,0,0,0 quality=high bgcolor=white width=670 height=550 id=studio_loader_embed align=middle allowScriptAccess=sameDomain allowFullScreen=false type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer; / /object /div - For the thisMovie() function I have tried all these combinations for IE: HTMLCollection.namedItem(movieName) // HTMLCollection is undefined namedItem(movieName) // Object expected document.getElementById // 'parent.thisMovie(...)' is null or not an object You can see this functionality work in FF by going here... http://www.silverscreendesign.com/designlab.cfm?proid=1264 ... and clicking on the Your Cart button in the right. Clicking that button should make the flash movie's tab go to Add Art It does not work in IE. Someone told me that IE cannot talk to an embed tag, only an object tag, but I believe the ID vs NAME issue is tripping me up. I would be more than happy to send a PayPal payment for your time. Thanks, Mik Michael Muller office (413) 863-6455 cell (413) 320-5336 skype: michaelBmuller http://MontagueWebWorks.com Information is not knowledge Knowlege is not wisdom Eschew Obfuscation ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324381 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: (ot) Javascript Help
There's probably something in jquery that'll do it on one line of cross browser code... mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2009/7/9 Michael Muller mich...@mullertech.com: Ok, I need some Javascript help. I just cannot get this script (residing in an iframe)... script parent.thisMovie('studio_loader_embed').reloadClipart(); parent.thisMovie('studio_loader_embed').showTab(2); /script ...to go through this script... script function thisMovie(movieName) { if (navigator.appName.indexOf(Microsoft) != -1) { return HTMLCollection.namedItem(movieName) } else { return document[movieName] } } /script ...to function on this object... div style=margin:0px; padding:5px; width:670px; float:left; object classid=clsid:d27cdb6e-ae6d-11cf-96b8-44455354 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0; width=670 height=550 param name=allowScriptAccess value=sameDomain / param name=allowFullScreen value=false / param name=movie value=/flash/studio_loader.swf?urlvars=1264,0,0,0,0,0 / param name=quality value=high / param name=bgcolor value=white / embed src=/flash/studio_loader.swf?urlvars=1264,0,0,0,0,0 quality=high bgcolor=white width=670 height=550 id=studio_loader_embed align=middle allowScriptAccess=sameDomain allowFullScreen=false type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer; / /object /div - For the thisMovie() function I have tried all these combinations for IE: HTMLCollection.namedItem(movieName) // HTMLCollection is undefined namedItem(movieName) // Object expected document.getElementById // 'parent.thisMovie(...)' is null or not an object You can see this functionality work in FF by going here... http://www.silverscreendesign.com/designlab.cfm?proid=1264 ... and clicking on the Your Cart button in the right. Clicking that button should make the flash movie's tab go to Add Art It does not work in IE. Someone told me that IE cannot talk to an embed tag, only an object tag, but I believe the ID vs NAME issue is tripping me up. I would be more than happy to send a PayPal payment for your time. Thanks, Mik Michael Muller office (413) 863-6455 cell (413) 320-5336 skype: michaelBmuller http://MontagueWebWorks.com Information is not knowledge Knowlege is not wisdom Eschew Obfuscation ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324386 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: (ot) Javascript Help
Someone told me that IE cannot talk to an embed tag, only an object tag, but I believe the ID vs NAME issue is tripping me up. I don't think IE uses the EMBED tag at all. Give your OBJECT an ID of its own, and use that when you're in IE. 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! ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324387 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
(ot) javascript help
Can any javascript gurus tell me why this does not work? I want the br tag to display on the page so I get a carriage return between the two pieces of text Foo and Moo. I get this error in Firbug: document.tabbedTicket.FTDTYPEe has no properties script function makeNewEntry() { document.tabbedTicket.FTDTYPEe.style.visibility = 'visible'; document.tabbedTicket.FTDTYPEe.style.display = ''; } /script form action=preferences.cfm method=post id=tabbedTicket name=tabbedTicket input value=+ type=button style=font-size:9px; onclick=makeNewEntry(); title=Add New FTD Typebr / Foo br id=FTDTYPEe style=visibility:hidden; display: none; / Moo /form ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307256 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: (ot) javascript help
try document.getElementById(FTDTYPEe). And then go get some library that will take care of all that for you (jQuery, Prototype, etc.). cheers, barneyb On Wed, Jun 11, 2008 at 10:34 AM, Chad Gray [EMAIL PROTECTED] wrote: Can any javascript gurus tell me why this does not work? I want the br tag to display on the page so I get a carriage return between the two pieces of text Foo and Moo. I get this error in Firbug: document.tabbedTicket.FTDTYPEe has no properties script function makeNewEntry() { document.tabbedTicket.FTDTYPEe.style.visibility = 'visible'; document.tabbedTicket.FTDTYPEe.style.display = ''; } /script form action=preferences.cfm method=post id=tabbedTicket name=tabbedTicket input value=+ type=button style=font-size:9px; onclick=makeNewEntry(); title=Add New FTD Typebr / Foo br id=FTDTYPEe style=visibility:hidden; display: none; / Moo /form ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307257 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: (ot) javascript help
because br isn't an element of form? try removing the tabbedTicket or use getElementById On Wed, Jun 11, 2008 at 12:34 PM, Chad Gray [EMAIL PROTECTED] wrote: Can any javascript gurus tell me why this does not work? I want the br tag to display on the page so I get a carriage return between the two pieces of text Foo and Moo. I get this error in Firbug: document.tabbedTicket.FTDTYPEe has no properties script function makeNewEntry() { document.tabbedTicket.FTDTYPEe.style.visibility = 'visible'; document.tabbedTicket.FTDTYPEe.style.display = ''; } /script form action=preferences.cfm method=post id=tabbedTicket name=tabbedTicket input value=+ type=button style=font-size:9px; onclick=makeNewEntry(); title=Add New FTD Typebr / Foo br id=FTDTYPEe style=visibility:hidden; display: none; / Moo /form ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307258 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: (ot) javascript help
I may be way off-base, but do you need that trailing e in FTDTYPEe? Could it be the missing e from Firbug? m!ke On Wed, Jun 11, 2008 at 10:34 AM, Chad Gray [EMAIL PROTECTED] wrote: Can any javascript gurus tell me why this does not work? I want the br tag to display on the page so I get a carriage return between the two pieces of text Foo and Moo. I get this error in Firbug: document.tabbedTicket.FTDTYPEe has no properties ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307259 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: (ot) javascript help
There's an easier way to do this... Rather than using a br and assigning an id to it, use a div. Divs have built in properties that aren't included in br tags. -Original Message- From: Chad Gray [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2008 12:34 PM To: CF-Talk Subject: (ot) javascript help Can any javascript gurus tell me why this does not work? I want the br tag to display on the page so I get a carriage return between the two pieces of text Foo and Moo. I get this error in Firbug: document.tabbedTicket.FTDTYPEe has no properties script function makeNewEntry() { document.tabbedTicket.FTDTYPEe.style.visibility = 'visible'; document.tabbedTicket.FTDTYPEe.style.display = ''; } /script form action=preferences.cfm method=post id=tabbedTicket name=tabbedTicket input value=+ type=button style=font-size:9px; onclick=makeNewEntry(); title=Add New FTD Typebr / Foo br id=FTDTYPEe style=visibility:hidden; display: none; / Moo /form ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307260 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: (ot) javascript help
Quite a few issues there... First off, you can generally use one or the other of visibility or display properties. In your case you'd probably want to use display since this will actually create or destroy the space that the br occupies. Then, in makeNewEntry you'd want this one line: document.getElementById('FTDTYPEe').style.display = 'block'; // since it is an id, you can reference it directly, independent of the form Finally, you can remove the visibility property from the br: br id=FTDTYPEe style=display: none; / That should get you where you need to be. -- Josh - Original Message - From: Chad Gray [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Wednesday, June 11, 2008 10:34 AM Subject: (ot) javascript help Can any javascript gurus tell me why this does not work? I want the br tag to display on the page so I get a carriage return between the two pieces of text Foo and Moo. I get this error in Firbug: document.tabbedTicket.FTDTYPEe has no properties script function makeNewEntry() { document.tabbedTicket.FTDTYPEe.style.visibility = 'visible'; document.tabbedTicket.FTDTYPEe.style.display = ''; } /script form action=preferences.cfm method=post id=tabbedTicket name=tabbedTicket input value=+ type=button style=font-size:9px; onclick=makeNewEntry(); title=Add New FTD Typebr / Foo br id=FTDTYPEe style=visibility:hidden; display: none; / Moo /form ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307262 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: (ot) javascript help
Ah... that makes sense. Thanks everyone for the help! -Original Message- From: Greg Morphis [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2008 1:39 PM To: CF-Talk Subject: Re: (ot) javascript help because br isn't an element of form? try removing the tabbedTicket or use getElementById On Wed, Jun 11, 2008 at 12:34 PM, Chad Gray [EMAIL PROTECTED] wrote: Can any javascript gurus tell me why this does not work? I want the br tag to display on the page so I get a carriage return between the two pieces of text Foo and Moo. I get this error in Firbug: document.tabbedTicket.FTDTYPEe has no properties script function makeNewEntry() { document.tabbedTicket.FTDTYPEe.style.visibility = 'visible'; document.tabbedTicket.FTDTYPEe.style.display = ''; } /script form action=preferences.cfm method=post id=tabbedTicket name=tabbedTicket input value=+ type=button style=font-size:9px; onclick=makeNewEntry(); title=Add New FTD Typebr / Foo br id=FTDTYPEe style=visibility:hidden; display: none; / Moo /form ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307265 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
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! ~| 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:279454 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
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:238263 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: OT: Javascript help
the most I can think of is to evaluate the value right at the function declaration: objA.onclick = eval ('function(){ alert( ' + intI + ' ); };'); On 4/20/06, Ben Nadel [EMAIL PROTECTED] wrote: 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:238286 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: OT: Javascript help
Zaphod, I think that solution works for strings/numbers, but I would also like this to work with object refrences ... Something like: objMenu.onmouseover = function(){ objMenuSystem.Show(this); } The problem here is the same... When the mouse over fires, objMenuSystem is no undefined since it tries to find it reference to the Menu, not the varaible reference. But then again, if I wanted it to work my way, this would be off too, since it would point to the housing method... Not the objMenu... Hmmm .. .and ... Dangy! ... Ben Nadel www.bennadel.com -Original Message- From: Zaphod Beeblebrox [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 10:31 AM To: CF-Talk Subject: Re: OT: Javascript help the most I can think of is to evaluate the value right at the function declaration: objA.onclick = eval ('function(){ alert( ' + intI + ' ); };'); On 4/20/06, Ben Nadel [EMAIL PROTECTED] wrote: 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:238288 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: OT: Javascript help
Asking your question of my javascipt list, the responses were as follows: Repsonse 1 Have you tried this? objA.onclick = new Function (alert( + intI + ) ); Response 2 for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); Place one var objA; before the loop then remove the var inside. Redeclaring a variable is a bad practice that will bite you in other languages. objA.onclick = function(){ alert( intI ); }; It's doing its job, it's alerting the value of intI, which is what you left it. The easiest solution is to add a custom property to the object to hold the current value of intI: objA.currentI = intI; objA.onclick = function(){ alert( this.currentI ); }; Response 3 objA.onclick = new Function (alert( + intI + ) ); This should work, but from what I understand new Function (like eval) must be compiled on the spot, so there's a (however slight) performance hit. http://userjs.org/help/tutorials/efficient-code Hope some of this helps Cutter Ben Nadel wrote: 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:238310 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: OT: Javascript help
Hi Ben, I ran into this problem recently - these really helped me out: http://joust.kano.net/weblog/archive/2005/08/08/a-huge-gotcha-with-javascript-closures and http://jibbering.com/faq/faq_notes/closures.html /t ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238312 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: OT: Javascript help
Cutter, I like this suggestion: objA.currentI = intI; objA.onclick = function(){ alert( this.currentI ); }; This is actually how I deal with this same problem in Flash Action Script sometimes. However, in Flash I do it on objects, and in JS it always makes me nervous to try adding data to an object that doesn't inherently have that attribute. ... Ben Nadel www.bennadel.com -Original Message- From: Cutter (CFRelated) [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 1:00 PM To: CF-Talk Subject: Re: OT: Javascript help Asking your question of my javascipt list, the responses were as follows: Repsonse 1 Have you tried this? objA.onclick = new Function (alert( + intI + ) ); Response 2 for (var intI = 0 ; intI 10 ; intI++){ var objA = document.createElement( div ); Place one var objA; before the loop then remove the var inside. Redeclaring a variable is a bad practice that will bite you in other languages. objA.onclick = function(){ alert( intI ); }; It's doing its job, it's alerting the value of intI, which is what you left it. The easiest solution is to add a custom property to the object to hold the current value of intI: objA.currentI = intI; objA.onclick = function(){ alert( this.currentI ); }; Response 3 objA.onclick = new Function (alert( + intI + ) ); This should work, but from what I understand new Function (like eval) must be compiled on the spot, so there's a (however slight) performance hit. http://userjs.org/help/tutorials/efficient-code Hope some of this helps Cutter Ben Nadel wrote: 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:238315 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: OT: Javascript help
TanGuy, Thanks, I think that first link helped a lot. I see what the guy is saying (and I forgot that var's all get moved up to the highest scope - its sad that I used to aide a web-dev class). So now, I have something that works in terms of passing around variables that make sense: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleJavascript Dynamic Variables/title script type=text/javascript function TestClass( strName ){ this.Name = strName; } TestClass.prototype.AlertValue = function( anyValue ){ alert( this.Name + is alerting: + anyValue ); } function Init(){ var objContentDiv = document.getElementById( content ); var objA = null; var objTest = new TestClass( Tester ); // This runs the for loop using a LOCAL scope for each iteration. (function loop( intI ){ var intX = intI; if (intI 10){ // Create new A element. objA = document.createElement( a ); // Set A display properties. objA.style.display = block; objA.style.backgroundColor = #F8F8F8; objA.style.border = 1px solid #33; objA.style.padding = 10px 10px 10px 10px; objA.style.color = #33; objA.style.marginBottom = 15px; // Create text for the link. objA.appendChild( document.createTextNode( I should alert + intX + when clicked ) ); // Set the href. objA.setAttribute( href, ## ); // Set the onclick method. objA.onclick = function(){ objTest.AlertValue( intX ) }; // Attach the A to the content. objContentDiv.appendChild( objA ); loop(intI + 1); } })(0); } // Is the tester class available here (just testing). alert( objTest is of type: + typeof(objTest)); /script /head body onload=Init(); div id=content/div /body /html Thanks for everyone's help. I think I now see the local scoping issue that I was dealing with before. I will try to return with a better example. ... Ben Nadel www.bennadel.com -Original Message- From: Tanguy Rademakers [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 1:19 PM To: CF-Talk Subject: Re: OT: Javascript help Hi Ben, I ran into this problem recently - these really helped me out: http://joust.kano.net/weblog/archive/2005/08/08/a-huge-gotcha-with-javascrip t-closures and http://jibbering.com/faq/faq_notes/closures.html /t ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238316 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
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 ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226261 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
Slight OT: JavaScript Help
Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
I think it is something like window.opener.location=('yourlocation.cfm'); -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
Why do you want to refresh the window? Why not just have javascript pass the values back to the form and close the top window? -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
You get the Guru trophy of the day (I think it's a 9 year old twinkie). That is exactly what I needed. -mk -Original Message- From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:54 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help I think it is something like window.opener.location=('yourlocation.cfm'); -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
Ok - how would I do that? could I use the window.opener object like window.opener.form[index] type syntax to add? I would need to be able to append a new item to an existing select box. The value would be an int and the text would be a string. In other words, in html: option value=3My pet shop/option - I have to be able to set both of these items. I'm sure it's possible, but I've not done it before. -mk -Original Message- From: Kris Pilles [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:56 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help Why do you want to refresh the window? Why not just have javascript pass the values back to the form and close the top window? -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
- Original Message - From: Mark A. Kruger - CFG [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, September 12, 2002 7:17 AM Subject: RE: Slight OT: JavaScript Help Ok - how would I do that? could I use the window.opener object like window.opener.form[index] type syntax to add? I would need to be able to append a new item to an existing select box. The value would be an int and the text would be a string. In other words, in html: option value=3My pet shop/option - I have to be able to set both of these items. I'm sure it's possible, but I've not done it before. Hi Mark: opener.formName.selectName[opener.formName.selectName.options.length] = new Option(text, value); (where 'text' is the text that shows up in the drop-down, and 'value' is the value of the option). hth, charlie -mk -Original Message- From: Kris Pilles [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:56 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help Why do you want to refresh the window? Why not just have javascript pass the values back to the form and close the top window? -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
var callerWindowObj = dialogArguments; callerWindowObj.retssn = document.frmName.employees.value; callerWindowObj.retname = document.forms[frmName].employees.options[document.forms[frmName].em ployees.selectedIndex].text; -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 10:26 AM To: CF-Talk Subject: Re: Slight OT: JavaScript Help - Original Message - From: Mark A. Kruger - CFG [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, September 12, 2002 7:17 AM Subject: RE: Slight OT: JavaScript Help Ok - how would I do that? could I use the window.opener object like window.opener.form[index] type syntax to add? I would need to be able to append a new item to an existing select box. The value would be an int and the text would be a string. In other words, in html: option value=3My pet shop/option - I have to be able to set both of these items. I'm sure it's possible, but I've not done it before. Hi Mark: opener.formName.selectName[opener.formName.selectName.options.length] = new Option(text, value); (where 'text' is the text that shows up in the drop-down, and 'value' is the value of the option). hth, charlie -mk -Original Message- From: Kris Pilles [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:56 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help Why do you want to refresh the window? Why not just have javascript pass the values back to the form and close the top window? -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
Charlie, Thanks a lot. I appreciate the help from sunny AZ. -mk -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:26 AM To: CF-Talk Subject: Re: Slight OT: JavaScript Help - Original Message - From: Mark A. Kruger - CFG [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, September 12, 2002 7:17 AM Subject: RE: Slight OT: JavaScript Help Ok - how would I do that? could I use the window.opener object like window.opener.form[index] type syntax to add? I would need to be able to append a new item to an existing select box. The value would be an int and the text would be a string. In other words, in html: option value=3My pet shop/option - I have to be able to set both of these items. I'm sure it's possible, but I've not done it before. Hi Mark: opener.formName.selectName[opener.formName.selectName.options.length] = new Option(text, value); (where 'text' is the text that shows up in the drop-down, and 'value' is the value of the option). hth, charlie -mk -Original Message- From: Kris Pilles [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:56 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help Why do you want to refresh the window? Why not just have javascript pass the values back to the form and close the top window? -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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: Slight OT: JavaScript Help
Kris - thanks. I'll give it a try. -mk -Original Message- From: Kris Pilles [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:26 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help var callerWindowObj = dialogArguments; callerWindowObj.retssn = document.frmName.employees.value; callerWindowObj.retname = document.forms[frmName].employees.options[document.forms[frmName].em ployees.selectedIndex].text; -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 10:26 AM To: CF-Talk Subject: Re: Slight OT: JavaScript Help - Original Message - From: Mark A. Kruger - CFG [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, September 12, 2002 7:17 AM Subject: RE: Slight OT: JavaScript Help Ok - how would I do that? could I use the window.opener object like window.opener.form[index] type syntax to add? I would need to be able to append a new item to an existing select box. The value would be an int and the text would be a string. In other words, in html: option value=3My pet shop/option - I have to be able to set both of these items. I'm sure it's possible, but I've not done it before. Hi Mark: opener.formName.selectName[opener.formName.selectName.options.length] = new Option(text, value); (where 'text' is the text that shows up in the drop-down, and 'value' is the value of the option). hth, charlie -mk -Original Message- From: Kris Pilles [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:56 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help Why do you want to refresh the window? Why not just have javascript pass the values back to the form and close the top window? -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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: Slight OT: JavaScript Help
Just as an FYI, you can also use window.opener.location.reload() or place onfocus=location.reload() in the body tag of the page which opens the popup. Either of these will give you slightly different results, so it's a matter of figuring out which is the right tool for this particular job. :) Isaac Dealey Certified Advanced ColdFusion 5 Developer www.turnkey.to 954-776-0046 You get the Guru trophy of the day (I think it's a 9 year old twinkie). That is exactly what I needed. -mk -Original Message- From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:54 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help I think it is something like window.opener.location=('yourlocation.cfm'); -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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: Slight OT: JavaScript Help
Thanks Isaac, I'll file both of those away - great ideas. -Original Message- From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 10:47 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help Just as an FYI, you can also use window.opener.location.reload() or place onfocus=location.reload() in the body tag of the page which opens the popup. Either of these will give you slightly different results, so it's a matter of figuring out which is the right tool for this particular job. :) Isaac Dealey Certified Advanced ColdFusion 5 Developer www.turnkey.to 954-776-0046 You get the Guru trophy of the day (I think it's a 9 year old twinkie). That is exactly what I needed. -mk -Original Message- From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 8:54 AM To: CF-Talk Subject: RE: Slight OT: JavaScript Help I think it is something like window.opener.location=('yourlocation.cfm'); -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 9:45 AM To: CF-Talk Subject: Slight OT: JavaScript Help Folks, Some JavaScript guru out there can answer this in a second. I have a form window with a link that pops up a simple form to add some piece or pieces of data to a lookup table. When the user is done adding, I want them to click a button and have the window close - and the page behind it refresh. I can close the window no problem (onclick='window.close()') - but I cannot figure out how to get the original page to refresh. Of course cflocation doesn't help me because it puts the page into the pop-up window, which I want to get rid of after the add operation. Anyone have a quick solution to this? -mk __ 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
OT: JavaScript Help - PLEASE!
Folks: 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. Problem: We have hundreds of pages that (unfortunately) refer to a form by document.form[0]. We are now attempting to add a form to the top of the page, thus making it the new document.form[0]. Rather than re-coding the existing pages to use document.formName (which should have been done in the first place) we need a solution that will allow a form that appears first on the page to be anything BUT document.form[0]. 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? ANY help would be greatly appreciated! Thanks, Christian N. Abad __ 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: OT: JavaScript Help - PLEASE!
oi Christian!! might be..dunno..I'd just do a global search and replace in studio. and rename it [1] -- Critz Macromedia Certified Advanced ColdFusion Developer CFX_BotMaster Network=Efnet Channel=ColdFusion Friday, August 9, 2002, 10:32:03 AM, you wrote: CA Folks: CA I'm in a bit of a quandary here, and was hoping that some if the brilliant CA minds on this list could offer some insight. CA Problem: CA We have hundreds of pages that (unfortunately) refer to a form by CA document.form[0]. We are now attempting to add a form to the top of the CA page, thus making it the new document.form[0]. Rather than re-coding the CA existing pages to use document.formName (which should have been done in the CA first place) we need a solution that will allow a form that appears first on CA the page to be anything BUT document.form[0]. CA Questions: CA Is there any way to spoof the DOM into thinking that the first form on the CA page is document.form[100]? (Can you override how the DOM indexes objects in CA a page?) Is there another way to work around this? CA ANY help would be greatly appreciated! CA Thanks, CA Christian N. Abad CA __ 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: OT: JavaScript Help - PLEASE!
I would probably use a multi-file RegularExpression replacement in ColdFusion studio ... be very careful tho... and replace all the references to document.form[0] with document.myformname and give form[0] the name it needs... the regex I'm sure will only be necessary for adding the form name, because you need to make sure you're only affecting the correct forms. Isaac Dealey Certified Advanced ColdFusion Developer www.turnkey.to 954-776-0046 Folks: 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. Problem: We have hundreds of pages that (unfortunately) refer to a form by document.form[0]. We are now attempting to add a form to the top of the page, thus making it the new document.form[0]. Rather than re-coding the existing pages to use document.formName (which should have been done in the first place) we need a solution that will allow a form that appears first on the page to be anything BUT document.form[0]. 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? ANY help would be greatly appreciated! Thanks, Christian N. Abad __ 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
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 __ 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: OT: Javascript help
www.irt.org On Tue, 2 Jul 2002, Kris Pilles wrote: 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
OT Javascript Help
script for window event=onresize reload(); /script This is a shot in the dark on my part. I would like for the page to reload if the user resizes the screen in any way. Please help. Joshua Tipton __ 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: OT Javascript Help
Not sure about other browsers, but in IE you can use body onresize=location.reload(); or if you're already past the body tag I believe it's window.onresize = location.reload; note that there are no () parenthesis in the 2nd case ... Out of curiosity ... Why are you wanting to reload the document when the window resizes? Do you have objects on the page that are positioned absolutely using CSS? In any event ... a widely supported (os/browsers) solution may be tough to come by ... Isaac www.turnkey.to 954-776-0046 __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.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: OT Javascript Help
Having to use unfortunate frames for one small part and it messes everything up when you resize the screen. Thanks for your help it worked. Joshua Tipton -Original Message- From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 11:04 PM To: CF-Talk Subject: Re: OT Javascript Help Not sure about other browsers, but in IE you can use body onresize=location.reload(); or if you're already past the body tag I believe it's window.onresize = location.reload; note that there are no () parenthesis in the 2nd case ... Out of curiosity ... Why are you wanting to reload the document when the window resizes? Do you have objects on the page that are positioned absolutely using CSS? In any event ... a widely supported (os/browsers) solution may be tough to come by ... Isaac www.turnkey.to 954-776-0046 __ 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
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: OT: Javascript Help
var fiveMinutes=30; //milliseconds in 5 minutes var now = new Date(); var temp=now.getTime() //temp=now in milliseconds var newTime=new Date(eval(temp+fiveMinutes)); //newTime is now 5 minutes from now or trimmed down var newTime=new Date(new Date().getTime()+3).toLocaleString() ; clint [EMAIL PROTECTED] on 01/10/2002 12:35:21 PM Please respond to [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] cc: 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! __ Get Your Own 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=coldfusionb 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: OT: Javascript Help
www.irt.org On Thu, 10 Jan 2002, clint wrote: 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! __ Why Share? Dedicated Win 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=coldfusionc 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: OT: Javascript Help
theDate = new Date(); myMinutes = 5 + theDate.getMinutes(); At 1:35 PM -0500 1/10/02, clint wrote: 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
OT: JavaScript Help
This is slowly driving me insane .. you would think this would be an easy thing to do (what I'm trying to accomplish, not driving me insane =-p ) I have a table with dynamicly generated rows. Each row has 2 cells. The first cell in each row has an ID. When a row is clicked it triggers a JavaScript function and passes the ID of the first cell to it. When this happens, I want the function to change the background color of the first cell. Here is what I have so far: function addStudentToList(studentPK) { tdID = id + studentPK; if (studentList.Item(studentPK) == studentPK) { studentList.Remove(studentPK); document.all.tdID.runtimeStyle.backgroundColor = document.all.tdID.style.backgroundColor; } else { studentList.Item(studentPK) = studentPK; document.all.tdID.runtimeStyle.backgroundColor = yellow; } } tdID is the variable that contains the ID of the first cell. It looks something like id38, etc. How do I get JavaScript to evaluate tdID into its true value and not think that I'm refering to an object named tdID? Anyone? Todd ~~ 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