Jump to content

Type Mismatch Error


makeshift_theory

Recommended Posts

I have been looking at this for hours and I can't seem to locate the source.  I am only receiving this error in Internet Explorer, I am receiving "Type Mismatch" at line 86.  However line number is worthless in IE because error handling in IE sucks. 

It declares the following error is in the text.php page and occurs when I click the "process" button.

[code]
<html>
<head>
<script type="text/javascript" src="chat_app.js"></script>
<script type="text/javascript">
var timeron = false; // timer on indicator
var closetimer = null ; // timer to control smilies
var user = "maryj"; // assign user

<!--
function showsmilies(on)
{

var smilies = document.getElementById("smilies");
if(on == "on")
{
smilies.style.display = "block";
}
}
function startTimer()
{
if(timeron == false)
{
closetimer = setTimeout("hidesmilies()",5000);
timeron = true;
}
}
function stopTimer()
{
if(timeron == true)
{
closetimer = clearTimeout(closetimer);
timeron = false;
}
}
function hidesmilies()
{
var smilies = document.getElementById("smilies");
smilies.style.display = "none";
}

function checkSelection(type,img) {
//IE/Win
var t = type;
if(t == 'a')
{
var link = prompt("Please enter in url:", "");
}
var field = document.post.msg;
if (document.selection && document.selection.createRange) {
field.focus();
strSelection = document.selection.createRange();
if (strSelection!="") {
var tagopen = null, tagclose = null;
switch(type)
{
case "b" : tagopen = "[b]"; tagclose = "[/b]"; break;
case "u" : tagopen = "[u]"; tagclose = "[/u]"; break;
case "i" : tagopen = "[i]"; tagclose = "[/i]"; break;
case "m" : tagopen = "[m]"; tagclose = ""; break;
case ">;)>" : tagopen = ">;)>"; tagclose = ""; break;
case "o!" : tagopen = "o!"; tagclose = ""; break;
case "???" : tagopen = "???"; tagclose = ""; break;
case ">>;)" : tagopen = ">>;)"; tagclose = ""; break;
case "<:)" : tagopen = "<:)"; tagclose = ""; break;
case ">:)" : tagopen = ">:)"; tagclose = ""; break;
case ">:)>~" : tagopen = ">:)>~"; tagclose = ""; break;
case ">:(" : tagopen = ">:("; tagclose = ""; break;
case ":(" : tagopen = ";("; tagclose = ""; break;
case ":-)" : tagopen = ":-)"; tagclose = ""; break;
case ">:-|>>" : tagopen = ">:-|>>"; tagclose = ""; break;
case "a" : tagopen = "[a src="+link+"]"; tagclose = "[/a]"; break;

}
strSelectionText = tagopen + strSelection.text + tagclose;
strSelection.text = strSelectionText;
field.focus();

}
//Text is not Selected
else {
alert ("IE: Text is not Selected");
}
}
//FF and Opera 8+
else if (field.selectionStart || field.selectionStart == '0')
{
//Text is Selected
if(field.selectionStart - field.selectionEnd != 0)
{
var startPos = field.selectionStart;
var endPos = field.selectionEnd;
var selection = field.value.substr(field.selectionStart, field.selectionEnd - field.selectionStart);
var begin = field.value.substring(0,startPos);
var end = field.value.substring(endPos,field.value.length);
var str = field.value.substring(startPos, endPos);
if(t == 'a')
var val = begin + "[" + t + " src=" + link + "]" + str + "[/" + t + "]" + end;
else
var val = begin + "[" + t + "]" + str + "[/" + t + "]" + end;
field.value=val;
if (field.setSelectionRange)
{

var start='',end=''; // Declare start and end variables
if(t == 'a')
start = 6 + link.length, end = 6; // if it's a link
else
start = 3, end = 4; // if not

field.setSelectionRange(startPos,start + endPos + end);
field.focus();
}
}
//Text is not Selected
else
{
if(t == "b" || t == "a" || t == "i" || t == "u")
{
field.value+="[" + t + "]" + "[/" + t + "]";
var begin = field.value.substr(0, field.selectionStart);
field.setSelectionRange(begin.length, (field.value.length - 4));
field.focus();
}
else
{
field.value+=t;
}
}
}
}



// -->
</script>
</head>

<body onLoad="javascript: getChatText();getUsers();">
<br><br><br><br><Br>
<form action="" method="get" name="post" onSubmit="return false">
<input type="button" value="B" onclick="checkSelection('b')">
<input type="button" value="I" onclick="checkSelection('i')">
<input type="button" value="U" onclick="checkSelection('u')">
<input type="button" value="P" onclick="checkSelection('p')">

<div id="smilies" onmouseover="showsmilies('on'); stopTimer()" onmouseout="showsmilies('off'); startTimer()" style="border:1px solid #000;width:150px;height:90px;display:none;position:absolute;top:10;left:80px;z-index:1;overflow:auto;background-color:#FFF">

<!-- start smilies -->
<img src="smilies/atomiccannon.gif"  border="0" onclick="checkSelection('>;)>');">
<img src="smilies/bomb.gif"  border="0" onclick="checkSelection('o!');">
<img src="smilies/confused.gif"  border="0" onclick="checkSelection('???');">
<img src="smilies/darkone.gif"  border="0" onclick="checkSelection('>>;)');">
<img src="smilies/dunce.gif"  border="0" onclick="checkSelection('<:)');">
<img src="smilies/evil.gif"  border="0" onclick="checkSelection('>:)');">
<img src="smilies/flamethrower.gif"  border="0" onclick="checkSelection('>:)>~');">
<img src="smilies/mad.gif"  border="0" onclick="checkSelection('>:(');">
<img src="smilies/sad.gif"  border="0" onclick="checkSelection(':(');">
<img src="smilies/smiles.gif"  border="0" onclick="checkSelection(':-)');">
<img src="smilies/sniper.gif"  border="0" onclick="checkSelection('>:-|>>');">
</div>
<input type="button" value="S" onmouseover="showsmilies('on'); stopTimer()" onmouseout="showsmilies('off'); startTimer()">
<input type="button" value="Link" onclick="checkSelection('a')">
<div id="content" style="float:right;width:500px;height:300px;overflow:auto;background-color:#DCDCDC;border:1px solid #000">

</div>
<br>
<pre>
<input type="text"  name="msg" id="msg" style="width:300px;height:40px" wrap="hard">


</pre>
<input onClick="sendChatText(0)" type="submit" value="Process Text" name="Process" id="Process">
<input type="submit" name="logout" id="logout" onClick="javascript: sendChatText(1)" value="Log Out">

</form>



<div id="chatroomlist" name="chatroomlist" style="border:1px solid #000000;width:200px;height:300px;">
<!-- Populates Chat Room List -->

</div>
</body>
</html>


[/code]
Link to comment
Share on other sites

Okay, after doing some research I have located the issue.  The issue is a AJAX issue, with IE you have to declare NEW function(this.req.handler)) for some odd reason.  Microsoft is just screwy like that I suppose.

PS > For those that were interested here is the code:

[code]
if (navigator.appName=="Microsoft Internet Explorer")
sendReq.onreadystatechange = new Function(handleSendChat(logout));
else
sendReq.onreadystatechange = handleSendChat(logout);
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.