Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / November 2004



Tip: Looking for answers? Try searching our database.

Convert cfoutput to Javascript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frosty1 - 29 Nov 2004 20:39 GMT
I need to change this javascript funtion into all javascript.  I need the cfif
isdefine, and cfoutput removed.  Could someone PLEASE show me how to do this?  
Thanks,  

function getSymbols()
{
    var map = getMainMap();
    var theSymColl = map.getSymbols();   
    var opt = new Option("-- Select a symbol --", "null");
    eval("document.draw_form.draw_symbol_name.options[0]=opt");
    for (var i=0; i < theSymColl.size(); i++){
        var opt = new Option(theSymColl.item(i), theSymColl.item(i));
        eval("document.draw_form.draw_symbol_name.options[i+1]=opt");
        <CFIF ISDEFINED("DRAW_SYMBOL_NAME")>
            <CFOUTPUT>
            var selectedSym = "#DRAW_SYMBOL_NAME#";
            </CFOUTPUT>
            if (theSymColl.item(i) == selectedSym){
                document.draw_form.draw_symbol_name.options[i+1].selected=true;
            }
        </CFIF>
    }
}
blewis - 30 Nov 2004 01:28 GMT
Not really possible.  The

<CFIF ISDEFINED("DRAW_SYMBOL_NAME")>

is checking a CF variable server side.  JS cannot do this.  JS is purely client-side scripting.

Bryan
vkunirs - 30 Nov 2004 09:03 GMT
hi  by doing some changes we can do this.  try in this way. <script>    var  
dramsymbolname=0; </script>  <CFIF ISDEFINED('DRAW_SYMBOL_NAME')>     <CFOUTPUT>    
 <script language='javascript'>                             var selectedSym =
'#DRAW_SYMBOL_NAME#';                             dramsymbolname=1;            
           </script>                </CFOUTPUT> </cfif>  function getSymbols()
{     var map = getMainMap();     var theSymColl = map.getSymbols();        var opt = new
Option('-- Select a symbol --', 'null');
    eval('document.draw_form.draw_symbol_name.options[0]=opt');     for (var i=0; i <
theSymColl.size(); i++){         var opt = new Option(theSymColl.item(i),
theSymColl.item(i));
        eval('document.draw_form.draw_symbol_name.options[i+1]=opt');                  if
(drawsymbolname=1)                                                     {        
                                        if (theSymColl.item(i) == selectedSym){
                document.draw_form.draw_symbol_name.options[i+1].selected=true;             }             }  
                                                    }     }   i think this
will solve your problem. and here i have just written a sample code for  you.
this is not as syntatically, please change as your requirements.  thanks  
Srinivas
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.