Hi,
I am trying to get a simple piece of code that includes javascript to run in a DNN Text/HTML module.
The code displays a text box and button. When the button is clicked, the testJoin() function is called which uses other functions in the external javascript http://assist.salt.na/webapi/api.js (referenced at beginning of code) to validate the input and return whatever is needed.
The code below works 100% when running as a plain HTML file directly via browser. (HTML, HEADER and BODY tags have been removed as you do with DNN modules)
When I place the code in a text/HMTL module then it shows up correctly with the text box and "Connect" button that is used with the 'innerHTML' functions. (check picture)
But when the Connect button is clicked, it just reloads the whole page - it does not seem to call the testJoin() function or the function is not working correctly or whatever.
I have tried adding
<script type="text/javascript" src="http://assist.salt.na/webapi/api.js?libs=join&webcallurl=http://assist.salt.na/__webcall__"></script>
to the header or footer of the module instead but it still does not work.
Can anyone tell me what I'm doing wroing?
Thanks!
CODE:
<body>
<script type="text/javascript" src="http://assist.salt.na/webapi/api.js?libs=join&webcallurl=http://assist.salt.na/__webcall__"></script>
<table cellspacing="0" cellpadding="0" border="0">
<tr valign="bottom">
<td valign="bottom">
<img src="http://angelcy.biz/salt/form/images/remoteassisttop.jpg" alt="top" width="205" height="56" valign="bottom">
</td>
</tr>
<tr bgcolor="#e0e4ef" height="145px">
<td valign="top">
<div class="connect_form" >
<form id="connect_form" action="" onsubmit="testJoin();return false">
<div id="sessionformtext1" class="title">
</div>
<div id="sessionformbutton" class="code">
</div>
</form>
<noscript><div class="title">
Javascript disabled<br>or not supported<br>by your browser!<br><br>For remote support<br>go instead to: <br><a style="color: #607797" href="http://assist.salt.na">http://assist.salt.na</a>
</div>
</noscript>
<div id="feedbackJoin"></div>
</div>
</td>
</tr>
<tr>
<td>
<img src="http://angelcy.biz/salt/form/images/remoteassistbottom.jpg" alt="bottom" width="205" height="21">
</td>
</tr>
</table>
<script type="text/javascript">
<!--
document.getElementById('sessionformtext1').innerHTML = 'Enter session code:'
document.getElementById('sessionformbutton').innerHTML = '<input type="text" name="code" id="code"/><span class="submit"><input type="submit" value="connect" /></span>'
//-->
</script>
<script type="text/javascript">
<!--
function testJoin(){
var f=document.getElementById('connect_form');
ISLOnline.Join.getSessionInfoByCode(
f.code.value,
function(info){
var e=document.getElementById('feedbackJoin');
e.className='start';
e.style.color="#333";
e.style.fontSize="13px";
e.style.textAlign="center";
e.style.marginLeft="-18px";
e.innerHTML='Click Start button:';
var b=document.createElement('input');
e.className='start';
b.type='button';
b.name='join';
b.value='Start';
b.onclick=function(){info.join()};
e.appendChild(b);
},
function(error){
var e=document.getElementById('feedbackJoin');
e.className='error';
e.style.textAlign="center";
e.innerHTML='Invalid session code!';
/* comment the line above and uncomment the line below if you wish to
display the error that is sent by the server */
//e.innerHTML=error.getDescription();
}
)
}
//-->
</script>
</body>
</html>
⇄
Detect language » English
⇄
Detect language » English
⇄
Detect language » English
⇄
Detect language » English
⇄
Detect language » English
⇄
Detect language » English
⇄
Detect language » English