LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 12 Oct 2010 02:56:52 -0400
Reply-To:     Søren Lassen <s.lassen@POST.TELE.DK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Søren Lassen <s.lassen@POST.TELE.DK>
Subject:      Re: Having problem inserting JavaScript into SAS INTRNET CGI
              program.
Comments: To: abebegashaw033@GMAIL.COM
Content-Type: text/plain; charset=ISO-8859-1

Abebe,

I am not entirely sure, but the put statement put ' onClick="hideAll();changeDiv("'atlanta'","'block'");">ATLANTA'; looks a bit strange to me - it puts a combination of constant text and the datastep variables ATLANTA and BLOCK - is that what you want?

If it is, you probably want to change the line to put ' onClick="hideAll();changeDiv("' atlanta +(-1) '","' block +(-1) '");">ATLANTA'; so that you do not get blanks after the variable values.

If, on the other hand, you want to output the constant values "atlanta" and "block" in sigle quotes, you should double the single quotes inside th string: put ' onClick="hideAll();changeDiv("''atlanta''","''block''");">ATLANTA';

Regards, Søren On Fri, 8 Oct 2010 06:18:33 -0400, Abebe Gashaw <abebegashaw033@GMAIL.COM> wrote:

> <SAS-L@listserv.vt.edu> >Hi Folks, >I am trying to use some JavaScript in my SAS INTRNET program. Some how it is >not working because somewhere else, I am making some quotation errors when I >call the JavaScript function. The SAS program looks like the following: >%macro runjavs; > data _Null_; > set IO end=last2; > file _webout; > put '<HTML>'; > put ' <head> ><script type="text/javascript"> ><!--'; >put 'SRC="http://ServerName/Topdir/dataloc_cmi.js">'<http://servername/Topd ir/dataloc_cmi.js%22%3E'> >; >put '</script> ></head> ><body>'; > > if _N_ = 1 then do; > Put '<Form Action="' "&_url" '" Method=Post>'; > put "<input type=hidden Name=_service" > " Value=&_service> "; > Put '<INPUT TYPE=hidden NAME=_debug VALUE="0"> '; > > put '<INPUT TYPE="hidden" NAME="_server" VALUE="' "&_SERVER" >'">'; > put '<INPUT TYPE="hidden" NAME="_port" VALUE="' "&_PORT" '">'; > put '<INPUT TYPE="hidden" NAME="_sessionid" VALUE="' >"&_SESSIONID" '">'; > put "<input type=hidden name=login > Value=&LOGIN >"; > put "<input type=hidden name=nobs > Value=&nobs >"; > Put "<input type=hidden Name=_program " > "Value=Accounting1.add_drp_up_verfy_Dev.sas>"; > end; > if _N_ = 1 then do; > put "<table width='100%' border='3' align='center' >cellpadding=1 cellspacing=1 bgcolor=#FFCCCC>"; > Put '<TR valign=top> <TD align="center"> > <h1> <B>please select CMI from the following option</h1> ></B> '; > put '<input type="radio" name="DCC_CMI" '; > put ' onClick="hideAll(); >changeDiv("'atlanta'","'block'");">ATLANTA'; > put' <div id="atlanta" style="margin-left:30px;display:none;">'; > put '<B><Font color=#000000>Select CMI </Font> </B>'; > put '<input type="radio" name="Response" value="45_00">00-CATI > <input type="radio" name="Response" value="45_10">10-PERM CATI'; > put '<input type="radio" name="Response" value="45_13">13-FAX > <input type="radio" name="Response" value="45_18">18-MAIL > <hr> > </div>'; > put '<input type="radio" name="DCC_CMI" '; > put ' onClick="hideAll(); changeDiv("'dallas'","'block'");">DALLAS'; > > put' <div id="dallas" style="margin-left:30px;display:none;">'; > put '<B><Font color=#000000>Select CMI </Font> </B>'; > put '<input type="radio" name="Response" value="46_00">00-CATI > <input type="radio" name="Response" value="46_10">10-PERM CATI'; > put '<input type="radio" name="Response" value="46_13">13-FAX > <input type="radio" name="Response" value="46_18">18-MAIL > <hr> > </div>'; > put ' <input type="radio" name="DCC_CMI"'; > put ' onClick="hideAll(); changeDiv("'kcdcc'","'block'");">KC'; > put ' <div id="kcdcc" style="margin-left:30px;display:none;">'; > put '<B><Font color=#000000>Select CMI </Font> </B>'; > put '<input type="radio" name="Response" value="47_00">00-CATI > <input type="radio" name="Response" value="47_10">10-PERM CATI'; > put '<input type="radio" name="Response" value="47_13">13-FAX > <input type="radio" name="Response" value="47_18">18-MAIL > <hr> > </div>'; > Put "<input type=submit Value=SUBMIT>"; > Put "<input type=Reset Value=RESET>"; > Put '</form>'; > put '</Body>'; > Put '</Html>'; > end; > run; > %mend; > %runjavs >/** The javaScript looks like the following ***/ ><script type="text/javascript"> ><!-- >function changeDiv(the_div,the_change) >{ > var the_style = getStyleObject(the_div); > if (the_style != false) > { > the_style.display = the_change; > } >} > >function hideAll() >{ > changeDiv("atlanta","none"); > changeDiv("dallas","none"); > changeDiv("kcdcc","none"); >} >function getStyleObject(objectId) { > if (document.getElementById && document.getElementById(objectId)) { > return document.getElementById(objectId).style; > } else if (document.all && document.all(objectId)) { > return document.all(objectId).style; > } else { > return false; > } >} >// --> ></script> >/*** This this the way I call the java functions ***/ > put '<input type="radio" name="DCC_CMI" '; > put ' onClick="hideAll(); >changeDiv("'atlanta'","'block'");">ATLANTA'; > put' <div id="atlanta" style="margin-left:30px;display:none;">'; > put '<B><Font color=#000000>Select CMI </Font> </B>'; > put '<input type="radio" name="Response" value="45_00">00-CATI > <input type="radio" name="Response" value="45_10">10-PERM CATI'; > put '<input type="radio" name="Response" value="45_13">13-FAX > <input type="radio" name="Response" value="45_18">18-MAIL > <hr> > </div>'; >/*** what is wrong with this java function call? *****/ >Thank you in advance


Back to: Top of message | Previous page | Main SAS-L page