Hi All,
I am trying to insert a picture at the bottom of a survey using CRM survey suite.
I used the code from FM:CRM_SVY_EXAMPLE_DYNAMIC_PBO , I did change the nodeDiv.setAttribute("align", "center") , but doesn't work.
My ABAP coding knoweldge is nil, please can somebody help me with how to insert the picture at the bottom of the survey.
CONSTANTS: lc_link_to_picture TYPE string
VALUE 'Imagelink'.
DATA: lt_javascript TYPE survy_t_javascript,
ls_javascript TYPE survy_s_javascript,
lt_svy_on_event TYPE survy_t_on_event,
ls_svy_on_event TYPE survy_s_on_event.
* <Create and insert JavaScript>
ls_javascript-name = 'insertImage'. "#EC NOTEXT
ls_javascript-language = 'JavaScript1.3'. "#EC NOTEXT
ls_javascript-script = 'function insertImage() {'. "#EC NOTEXT
CONCATENATE ls_javascript-script
'var nodeDiv = document.createElement(''div'');'
'nodeDiv.setAttribute("align", "center");'
'var nodeImg = document.createElement(''img'');'
INTO ls_javascript-script. "#EC NOTEXT
CONCATENATE ls_javascript-script
'nodeImg.setAttribute("src", "' lc_link_to_picture '");'
'nodeImg.setAttribute("alt", "");'
'nodeDiv.appendChild(nodeImg);'
INTO ls_javascript-script. "#EC NOTEXT
CONCATENATE ls_javascript-script
'document.getElementsByTagName(''body'')[0].insertBefore'
'(nodeDiv, document.getElementsByTagName(''body'')[0].firstChild);}'
INTO ls_javascript-script. "#EC NOTEXT
APPEND ls_javascript TO lt_javascript.
CALL METHOD ir_survey_values->javascript_add
EXPORTING
it_script = lt_javascript.
* </Create and insert JavaScript>
* <Assign script to event onLoad in the BODY-tag>
ls_svy_on_event-question_id = 'html'. "#EC NOTEXT
ls_svy_on_event-answer_id = 'body'. "#EC NOTEXT
ls_svy_on_event-name = 'onLoad'. "#EC NOTEXT
CONCATENATE ls_javascript-name '()' INTO ls_svy_on_event-call_function."#EC NOTEXT
APPEND ls_svy_on_event TO lt_svy_on_event.
CALL METHOD ir_survey_values->on_event_add
EXPORTING
it_on_event = lt_svy_on_event.
Regards,
Dillip