为什么ie下良好的脚本,在twebbrowser里面会出错??(100分)

  • 主题发起人 主题发起人 daehappy
  • 开始时间 开始时间
D

daehappy

Unregistered / Unconfirmed
GUEST, unregistred user!
比如下面这一段代码。
input type="button" class="bginput" value=" B " onclick="vbcode(this.form,'B','')" onmouseover="stat('b')" title="BOLD (alt+b)" accesskey="b"
 
你把所有的HTML都贴出来吧,光这一段不好判断。
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>北信论坛 - 发布新主题</title>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>
<STYLE type=text/css>
.en { font-family: "MS Shell Dlg,Tahoma"; font-size: 9px}
FONT {font size="9pt"}
BODY {CURSOR: default; FONT-FAMILY: MS Shell Dlg,Tahoma; FONT-SIZE: 9pt; SCROLLBAR-BASE-COLOR: #4E76A1;
SCROLLBAR-ARROW-COLOR: #FFF788;
}

UL {CURSOR: default; FONT-FAMILY: MS Shell Dlg,Tahoma; FONT-SIZE: 9pt}
LI {CURSOR: default; FONT-FAMILY: MS Shell Dlg,Tahoma; FONT-SIZE: 9pt}
P {CURSOR: default; FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}
TD {FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}
TR {FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}
SELECT {BACKGROUND-COLOR: #cccccc; COLOR: #51485f; FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
INPUT {COLOR: #000000; FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}
TEXTAREA {BACKGROUND-COLOR: #cccccc; COLOR: #000000; FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}
OPTION {BACKGROUND-COLOR: #cccccc; COLOR: #51485f; FONT-SIZE: 9pt}
FORM {FONT-FAMILY: MS Shell Dlg,tahoma,宋体; FONT-SIZE: 9pt}
.thtcolor {COLOR: #171A39;}
#all A:active {COLOR: #EEEEFF }
#all A:visited {COLOR: #EEEEFF ;text-decoration: none}
#all A:hover {COLOR: #FFBE00 ;text-decoration: underline;}
#all A:link {COLOR: #EEEEFF;text-decoration: none}
#cat A:active { COLOR: #171A39;
text-decoration: none}
#cat A:visited { COLOR: #171A39 ;
text-decoration: none}
#cat A:hover { COLOR: #171A39 ;
text-decoration: underline}
#cat A:link { COLOR: #171A39 ;
text-decoration: none}
</STYLE>




<!--<script type="text/javascript" language="javascript" src="http://nic.biti.edu.cn/vbb/spellcheck/spch.js"></script>-->
<script language="javascript">
<!--
var postmaxchars = 50000;
function validate(theform) {
if (theform.message.value=="" || theform.subject.value=="") {
alert("请完成标题和内容栏.");
return false; }
if (postmaxchars != 0) {
if (theform.message.value.length > 50000) {
alert("你的信息太长了./n/n所允许的最多字符是 50000 ./n现在是 "+theform.message.value.length+" 字符.");
return false; }
else { return true; }
} else { return true; }
}
function checklength(theform) {
if (postmaxchars != 0) { message = "/n所允许的最大长度为 50000 字符."; }
else { message = ""; }
alert("你输入的文字为 "+theform.message.value.length+" 字符."+message);
}
//-->
</script>
</head>
<body bgcolor="#4E76A1" text="#EEEEEE" id="all" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000000" vlink="#000000" alink="#000000">
<!-- logo and buttons -->
<center>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="left" background="images/menu_background.gif"><a href="index.php?s="><img src="images/title.gif" border="0" alt="北信论坛"></a></td>
<td valign="bottom" align="right" nowrap background="images/menu_background.gif">
<!-- toplinks -->
<a href="chat/" target="_blank"><img src="images/chatrooms.gif" alt="从这里进入聊天室" border="0"></a>
<a href="usercp.php?s="><img src="images/top_profile.gif" alt="在这里你可以查看你订阅的主题, 使用悄悄话,编辑你的个人资料和进行喜好设置" border="0"></a>
<a href="register.php?s=&action=signup"><img src="images/top_register.gif" alt="免费注册!" border="0"></a>
<a href="calendar.php?s="><img src="images/top_calendar.gif" alt="论坛日历" border="0"></a>
<a href="memberlist.php?s="><img src="images/top_members.gif" alt="会员列表" border="0"></a>
<a href="misc.php?s=&action=faq"><img src="images/top_faq.gif" alt="常见问题解答" border="0"></a>
<a href="search.php?s="><img src="images/top_search.gif" alt="论坛搜索" border="0"></a>
<a href="index.php?s="><img src="images/top_home.gif" alt="返回首页" border="0"></a>
<!-- <a href="member.php?s=&action=logout"><img src="images/top_logout.gif" alt="退出论坛" border="0"></a> -->
 
<!-- /toplinks -->
</td>
</tr>
</table>
<!-- /logo and buttons -->

<!-- content table -->
<table bgcolor="#4E76A1" width="100%" cellpadding="10" cellspacing="0" border="0">
<tr>
<td>


<!-- breadcrumb -->
<table cellpadding="2" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td width="100%"><img src="images/vb_bullet.gif" align="middle" alt="北信论坛 : Powered by vBulletin version 2.0.1">
<font face="verdana, arial, helvetica" size="2" ><a href="index.php?s=">北信论坛</a> > <a href="forumdisplay.php?s=&forumid=108">灌水区</a></font></td>
</tr>
</table>
<!-- /breadcrumb -->



<br>

<form enctype="multipart/form-data" action="newthread.php" method="POST" name="vbform" onSubmit="return validate(this)">
<input type="hidden" name="s" value="">
<input type="hidden" name="forumid" value="108">
<input type="hidden" name="action" value="postthread">

<table cellpadding="0" cellspacing="0" border="0" bgcolor="#333333" width="100%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td bgcolor="#009A9C" colspan="2"><font face="verdana, arial, helvetica" size="2" color="#111111" class="thtcolor">发布新主题</font></td>
</tr>
<tr>
<td bgcolor="#4E76A1"><font face="verdana, arial, helvetica" size="2" >登陆用户:</font></td>
<td bgcolor="#4E76A1"><font face="verdana, arial, helvetica" size="2" >daehappya</font> <font face="verdana,arial,helvetica" size="1" ><a href="member.php?s=&action=logout">[退出登陆]</a></font></td>
</tr>

<tr bgcolor="#009ACE">
<td bgcolor="#009ACE"><font face="verdana, arial, helvetica" size="2" >标题:</font></td>
<td bgcolor="#009ACE"><font face="verdana, arial, helvetica" size="2" ><input type="text" class="bginput" name="subject" value="" size="40" maxlength="85" tabindex="1"></font></td>
</tr>
<tr>
<td bgcolor="#4E76A1" valign="top"><font face="verdana, arial, helvetica" size="2" >信息图标:</font><br>
<font face="verdana,arial,helvetica" size="1" ><input type="radio" name="iconid" value="0" CHECKED>  不使用图标</font></td>
<td bgcolor="#4E76A1"><font face="verdana,arial,helvetica" size="1" ><input type="radio" name="iconid" value="1" > <img src="images/icons/icon1.gif" height="15" width="15" align="middle" alt="Post">    <input type="radio" name="iconid" value="2" > <img src="images/icons/icon2.gif" height="15" width="15" align="middle" alt="Arrow">    <input type="radio" name="iconid" value="3" > <img src="images/icons/icon3.gif" height="15" width="15" align="middle" alt="Lightbulb">    <input type="radio" name="iconid" value="4" > <img src="images/icons/icon4.gif" height="15" width="15" align="middle" alt="Exclamation">    <input type="radio" name="iconid" value="5" > <img src="images/icons/icon5.gif" height="15" width="15" align="middle" alt="Question">    <input type="radio" name="iconid" value="6" > <img src="images/icons/icon6.gif" height="15" width="15" align="middle" alt="Cool">    <input type="radio" name="iconid" value="7" > <img src="images/icons/icon7.gif" height="15" width="15" align="middle" alt="Smile">    <br>
<input type="radio" name="iconid" value="8" > <img src="images/icons/icon8.gif" height="15" width="15" align="middle" alt="Angry">    <input type="radio" name="iconid" value="9" > <img src="images/icons/icon9.gif" height="15" width="15" align="middle" alt="Unhappy">    <input type="radio" name="iconid" value="10" > <img src="images/icons/icon10.gif" height="15" width="15" align="middle" alt="Talking">    <input type="radio" name="iconid" value="11" > <img src="images/icons/icon11.gif" height="15" width="15" align="middle" alt="Red face">    <input type="radio" name="iconid" value="12" > <img src="images/icons/icon12.gif" height="15" width="15" align="middle" alt="Wink">    <input type="radio" name="iconid" value="13" > <img src="images/icons/icon13.gif" height="15" width="15" align="middle" alt="Thumbs down">    <input type="radio" name="iconid" value="14" > <img src="images/icons/icon14.gif" height="15" width="15" align="middle" alt="Thumbs up">    </font></td>
</tr>

<script language="Javascript" src="vbcode.js"></script>
<script language="Javascript" src="vbcode_language.js"></script>
<style>
#codebuttons input { font-family: verdana, arial, helvetica; font-size: 11px; }
#codebuttons select { font-family: verdana, arial, helvetica; font-size: 11px; }
.smilieTable { border-width: 2px; border-style: outset; }
</style>

<tr id="codebuttons">
<td bgcolor="#009ACE" valign="top"><font face="verdana, arial, helvetica" size="2" >vB 代码</font>
<font face="verdana,arial,helvetica" size="1" >
[<a href="misc.php?action=bbcode#buttons" target="_blank">帮助</a>]<br>
<input type="radio" name="mode" value="0" title="Normal Mode: (alt+n)" accesskey="n"
onclick="setmode(this.value)" onmouseover="stat('norm')" checked> 常规模式
<br>
<input type="radio" name="mode" value="1" title="Normal Mode: (alt+e)" accesskey="e"
onclick="setmode(this.value)" onmouseover="stat('enha')" > 高级模式
</font></td>

<td bgcolor="#009ACE">

<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td nowrap><font face="verdana,arial,helvetica" size="1" >
<input type="button" class="bginput" value=" B " onclick="vbcode(this.form,'B','')" onmouseover="stat('b')" title="BOLD (alt+b)" accesskey="b"
><input type="button" class="bginput" value=" I " onclick="vbcode(this.form,'I','')" onmouseover="stat('i')" title="ITALIC (alt+i)" accesskey="i"
><input type="button" class="bginput" value=" U " onclick="vbcode(this.form,'U','')" onmouseover="stat('u')" title="UNDERLINE (alt+u)" accesskey="u" >
 

<select id="sizeselect"
onchange="fontformat(this.form,this.options[this.selectedIndex].value,'SIZE')" onmouseover="stat('size')">
<option value="0">SIZE</option><option value="1">small</option>
<option value="3">large</option>
<option value="4">huge</option></select

><select id="fontselect"
onchange="fontformat(this.form,this.options[this.selectedIndex].value,'FONT')" onmouseover="stat('font')">
<option value="0">FONT</option><option value="arial">Arial</option>
<option value="times new roman">Times</option>
<option value="courier new">Courier</option>
<option value="century gothic">Century</option></select

><select id="colorselect"
onchange="fontformat(this.form,this.options[this.selectedIndex].value,'COLOR')" onmouseover="stat('color')">
<option value="0">COLOR</option><!-- you should edit this list to remove the colors you don't want -->
<option value="skyblue" style="color:skyblue">sky blue</option>
<option value="royalblue" style="color:royalblue">royal blue</option>
<option value="blue" style="color:blue">blue</option>
<option value="darkblue" style="color:darkblue">dark-blue</option>
<option value="orange" style="color:orange">orange</option>
<option value="orangered" style="color:orangered">orange-red</option>
<option value="crimson" style="color:crimson">crimson</option>
<option value="red" style="color:red">red</option>
<option value="firebrick" style="color:firebrick">firebrick</option>
<option value="darkred" style="color:darkred">dark red</option>
<option value="green" style="color:green">green</option>
<option value="limegreen" style="color:limegreen">limegreen</option>
<option value="seagreen" style="color:seagreen">sea-green</option>
<option value="deeppink" style="color:deeppink">deeppink</option>
<option value="tomato" style="color:tomato">tomato</option>
<option value="coral" style="color:coral">coral</option>
<option value="purple" style="color:purple">purple</option>
<option value="indigo" style="color:indigo">indigo</option>
<option value="burlywood" style="color:burlywood">burlywood</option>
<option value="sandybrown" style="color:sandybrown">sandy brown</option>
<option value="sienna" style="color:sienna">sienna</option>
<option value="chocolate" style="color:chocolate">chocolate</option>
<option value="teal" style="color:teal">teal</option>
<option value="silver" style="color:silver">silver</option></select>
<br>

<input type="button" class="bginput" value="http://" title="Insert Hyperlink" onclick="namedlink(this.form,'URL')" onmouseover="stat('url')"
><input type="button" class="bginput" value=" @ " title="Insert Email Address" onclick="namedlink(this.form,'EMAIL')" onmouseover="stat('email')"
><input type="button" class="bginput" value="IMG" title="Insert Image" onclick="vbcode(this.form,'IMG','http://')" onmouseover="stat('img')">
 
<input type="button" class="bginput" value=" # " title="CODE" onclick="vbcode(this.form,'CODE','')" onmouseover="stat('code')"
><input type="button" class="bginput" value="PHP" title="PHP CODE" onclick="vbcode(this.form,'PHP','')" onmouseover="stat('php')"
><input type="button" class="bginput" value="List" title="Ordered List" accesskey="l" onclick="dolist(this.form)" onmouseover="stat('list')"
><input type="button" class="bginput" value="Quote" title="Insert Quote" onclick="vbcode(this.form,'QUOTE','')" onmouseover="stat('quote')"><br>

<input type="text" class="bginput" name="status" style="font-size:7pt" size="50" value="使用这些控制来插入VB代码">

</font></td>
<td> </td>
<td><font face="verdana,arial,helvetica" size="1" >
<input type="button" class="bginput" value=" x " accesskey="c" title="Close Current Tag (alt+c)" style="color:red; font-weight:bold" onclick="closetag(this.form)" onmouseover="stat('closecurrent')">
关闭当前标签<br>
<input type="button" class="bginput" value=" x " accesskey="x" title="Close All Open Tags (alt+x)" style="color:red; font-weight:bold" onclick="closeall(this.form)" onmouseover="stat('closeall')">
关闭所有标签
</font></td>
</tr>
</table>

</td>
</tr>
<tr>
<td bgcolor="#009ACE" valign="top" nowrap><font face="verdana, arial, helvetica" size="2" >内容:</font>
<p><font face="verdana,arial,helvetica" size="1" >
查看下面的论坛状态<br>
了解发帖可以使用<br>
的各种代码.
</font></p>
<table cellpadding="3" cellspacing="1" border="0" bgcolor="#4E76A1" class="smilieTable" align="center">
<tr>
<td colspan="3" align="center" bgcolor="#009ACE" style="border-width:1px; border-style:inset"><font face="verdana,arial,helvetica" size="1" >表情符号</font></td>
</tr>
<tr align='center'>
<td><a href="javascript:smilie(':)')"><img src="images/smilies/smile.gif" alt="smile" border="0"></a> </td>
<td><a href="javascript:smilie(':(')"><img src="images/smilies/frown.gif" alt="frown" border="0"></a> </td>
<td><a href="javascript:smilie(':o')"><img src="images/smilies/redface.gif" alt="embarrasment" border="0"></a> </td>
</tr>
<tr align='center'>
<td><a href="javascript:smilie(':D')"><img src="images/smilies/biggrin.gif" alt="big grin" border="0"></a> </td>
<td><a href="javascript:smilie(';)')"><img src="images/smilies/wink.gif" alt="wink" border="0"></a> </td>
<td><a href="javascript:smilie(':p')"><img src="images/smilies/tongue.gif" alt="stick out tongue" border="0"></a> </td>
</tr>
<tr align='center'>
<td><a href="javascript:smilie(':cool:')"><img src="images/smilies/cool.gif" alt="cool" border="0"></a> </td>
<td><a href="javascript:smilie(':rolleyes:')"><img src="images/smilies/rolleyes.gif" alt="roll eyes (sarcastic)" border="0"></a> </td>
<td><a href="javascript:smilie(':mad:')"><img src="images/smilies/mad.gif" alt="mad" border="0"></a> </td>
</tr>
<tr align='center'>
<td><a href="javascript:smilie(':eek:')"><img src="images/smilies/eek.gif" alt="eek!" border="0"></a> </td>
<td><a href="javascript:smilie(':confused:')"><img src="images/smilies/confused.gif" alt="confused" border="0"></a> </td>
<td> </td>
</tr>


</table></td>
<td bgcolor="#009ACE">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td><textarea name="message" rows="20" cols="70" wrap="virtual" tabindex="2"></textarea><br>
<font face="verdana,arial,helvetica" size="1" ><a href="javascript:checklength(document.vbform);">[检查文字长度]</a></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#4E76A1" valign="top"><font face="verdana, arial, helvetica" size="2" >选项:</font></td>
<td bgcolor="#4E76A1" valign="top"><font face="verdana,arial,helvetica" size="1" >
<input type="checkbox" name="parseurl" value="yes" CHECKED> 自动URLs分析: 自动判别网址加上连接 代码.
<br><input type="checkbox" name="email" value="yes" checked> 邮件通知: 当有人回复你的主题时你将收到邮件通知,限注册用户使用.
<br><input type="checkbox" name="disablesmilies" value="yes" > 在这个帖子中禁用表情符号

<br><input type="checkbox" name="signature" value="yes" CHECKED> 在信息中包括你个人资料中的签名. 只限注册用户使用.
</font></td>
</tr>
<tr>
<td bgcolor="#009ACE" valign="top"><font face="verdana, arial, helvetica" size="2" >上传文件:</font><br>
<font face="verdana,arial,helvetica" size="1" >最大: 102400 字节</font></td>
<td bgcolor="#009ACE" valign="top"><font face="verdana,arial,helvetica" size="1" ><input type="hidden" name="MAX_FILE_SIZE" value="2097152">
<input type="file" class="bginput" name="attachment"><br>
有效的文件扩展名: gif jpg png txt zip bmp jpeg ace</font></td>
</tr>

<tr>
<td bgcolor="#4E76A1" valign="top"><font face="verdana, arial, helvetica" size="2" >发布一个投票:</font></td>
<td bgcolor="#4E76A1"><font face="verdana,arial,helvetica" size="1" ><input type="checkbox" name="postpoll" value="yes" > 是! 发布投票<br>
初始选项数: <input type="text" class="bginput" size="10" name="polloptions" value="4"> (最多: 10)</font></td>
</tr>

</table>
</td></tr></table>

<br>

<table cellpadding="2" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td align="center"><font face="verdana, arial, helvetica" size="2" >
<input type="submit" class="bginput" name="submit" value="发布新主题" accesskey="s" tabindex="3">
<input type="submit" class="bginput" name="preview" value="帖子预览" accesskey="p" tabindex="4">
<!--<input type="button" class="bginput" value="拼写检查" onclick="var f=document.forms['vbform']; doSpell( 'en', f.message, 'http://nic.biti.edu.cn/vbb/spellcheck/sproxy.php', true);" tabindex="5">-->
</font></td>
</tr>
</table>

</form>

<table cellpadding="2" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td><font face="verdana,arial,helvetica" size="1" >论坛状态:<br><table border="0">
<tr>
<td><font face="verdana,arial,helvetica" size="1" >
你可以发布新主题<br>
你可以回复主题<br>
你可以上传附件<br>
你可以编辑自己的帖子
</font></td>
<td><font face="verdana,arial,helvetica" size="1" >
HTML代码 禁止<br>
<a href="misc.php?s=&action=bbcode" target="_blank">vB代码</a>允许<br>
<a href="misc.php?s=&action=showsmilies" target="_blank">表情符号</a>允许<br>
<a href="misc.php?s=&action=bbcode#imgcode" target="_blank">代码</a>禁止
</font></td>
</tr>
</table></font></td>
</tr>
</table>

</td>
</tr>
</table>
<!-- /content area table -->
</center>

<p align="center">
<font face="verdana, arial, helvetica" size="2" >< <a href="mailto:nic@biti.edu.cn">联系我们</a> - <a href="http://nic.biti.edu.cn/">北信网络信息中心</a>
<!-- - <a href="">论坛声明</a> --> ></font>
</p>

<p align="center"><font face="verdana,arial,helvetica" size="1" >
<!-- Do not remove this copyright notice -->
Powered by: vBulletin Version 2.0.1<br>
Translated and hacked by:<a href="http://vbb.yesky.net">Ztbbs</A>.<br>
Copyright ©2000, 2001, Jelsoft Enterprises Limited.<br>

<!-- Do not remove this copyright notice -->

</font></p>

</body>
</html>
 
麻烦 Adnil 大哥你了!
 
to daehappy:
这个html的脚本是有错误的,在ie下没有错误跳出来是因为你把ie的脚本调试选项去掉了。
 
谢谢你的回答!
不过逻辑上来说,twebbrowser其实就是ie。那么为什么ie不调试脚本,而webbrower却调试呢?
 
其实ie不调试有时还不好的。
这个是WebBrower自己的功能而已。
 
每一个IE的实例,在启动的时候都会自动读取配置信息,而webbriwser不会,估计这就是原因了。

我们自己写程序也能这样做,创建webbroswer,截取script出错事件,然后跟ie一样显示
在状态栏中。
 
多人接受答案了。
 
后退
顶部