JavaScrip - HTML duda
Publicado por Sergio (3 intervenciones) el 22/09/2017 17:22:55
Tengo una duda con respecto a lo que puedo y no hacer en un script. ¿Puedo apretar un botón y cambiar una parte del código de un script?
TENGO ESTE BOTÓN
TENGO ESTE SCRIPT
Pero necesito cambiar una línea:
se.src = '//storage.googleapis.com/code.snapengage.com/js/af0a7f19-b3ad-4b8d-af29-68024cd881c7.js';
por otro final que es este:
808d6fba-ff20-43a7-83ee-97d9a84c0ab1
de tal manera que quede
se.src = '//storage.googleapis.com/code.snapengage.com/js/808d6fba-ff20-43a7-83ee-97d9a84c0ab1.js';
Dado que aún no entiendo muy bien los scripts me gustaría saber si es posible.
De paso si me recomiendan un buen curso de javascript, les prometo que no volveré con esta clase de dudas. :P Espero
Adjunto el archivo al final, aunque tengo entendido que solo se ve realmente si lo pongo en línea
TENGO ESTE BOTÓN
1
<a href="#" onclick="SnapEngage.setWidgetId('808d6fba-ff20-43a7-83ee-97d9a84c0ab1'); SnapEngage.startLink();"> <img id="my-inline-button" src="<a href="https://help.snapengage.com/wp-content/blogs.dir/2/files/2017/01/leave-a-message.gif></a>
TENGO ESTE SCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!-- begin SnapEngage code -->
<script type="text/javascript">
(function () {
var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
se.src = '//storage.googleapis.com/code.snapengage.com/js/af0a7f19-b3ad-4b8d-af29-68024cd881c7.js';
var done = false;
se.onload = se.onreadystatechange = function() {
if (!done&&(!this.readyState||this.readyState==='loaded'||this.readyState==='complete')) {
done = true;
/* Place your SnapEngage JS API code below */
/* SnapEngage.allowChatSound(true); Example JS API: Enable sounds for Visitors. */
// Switch inline button image to your 'online' button when agent is online
SnapEngage.getAgentStatusAsync(function (online) {
var buttonImageSrc;
if (online) {
// IMPORTANT: Replace the link below with your own link to an ONLINE button image!
buttonImageSrc = 'https://help.snapengage.com/wp-content/blogs.dir/2/files/2017/01/chat-with-us.png';
} else {
// IMPORTANT: Replace the link below with your own link to an OFFLINE button image!
buttonImageSrc = 'https://help.snapengage.com/wp-content/blogs.dir/2/files/2017/01/leave-a-message.gif';
}
if (document.getElementById('my-inline-button')) {
document.getElementById('my-inline-button').src = buttonImageSrc;
// OPTIONAL: Hide the floatingbutton on pages where you are using an inline button
//SnapEngage.hideButton();
}
});
}
};
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
})();
</script>
<!-- end SnapEngage code -->
Pero necesito cambiar una línea:
se.src = '//storage.googleapis.com/code.snapengage.com/js/af0a7f19-b3ad-4b8d-af29-68024cd881c7.js';
por otro final que es este:
808d6fba-ff20-43a7-83ee-97d9a84c0ab1
de tal manera que quede
se.src = '//storage.googleapis.com/code.snapengage.com/js/808d6fba-ff20-43a7-83ee-97d9a84c0ab1.js';
Dado que aún no entiendo muy bien los scripts me gustaría saber si es posible.
De paso si me recomiendan un buen curso de javascript, les prometo que no volveré con esta clase de dudas. :P Espero
Adjunto el archivo al final, aunque tengo entendido que solo se ve realmente si lo pongo en línea
- index.zip(1,2 KB)
Valora esta pregunta
0