请问怎么在网页上建立个编辑框,等用户输入了个字符串以后传给个OCX?

pietrikgreat 2008-04-23 02:55:58
我现在要做个功能,在一个网页上弄个编辑框,等用户输入了个字符串以后把这个字符串传给一个OCX的SET方法,然后触发这个OCX的处理.
现在我用VC的wizard写了一个OCX,也加上了GET/SET方法.有哪位能给我写一段代码(我需要的只能是代码了,我自己对网页编程不怎么知道.说什么原理的我也不知道怎么用.)演示一下怎么建立编辑框,建立一个OK按钮,点OK了以后把编辑框里的内容取到传给OCX,然后再GET出来(验证一下SET得对不对.)
谢谢了.
...全文
63 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
pietrikgreat 2008-04-23
  • 打赏
  • 举报
回复
可以了,谢谢.
pietrikgreat 2008-04-23
  • 打赏
  • 举报
回复
请问一下,我照您的样子把代码加在我用WORDPAD产生的一个空白网页里,一输入字符串再一点,IE提示网页上有错误,请费心给看看这是怎么回事情.



<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=GB2312">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./Test%20Ocx%20use.files/filelist.xml">
<title>Test Ocx use</title>


<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>louisinwork</o:Author>
<o:LastAuthor>louisinwork</o:LastAuthor>
<o:Revision>1</o:Revision>
<o:TotalTime>1</o:TotalTime>
<o:Created>2008-04-17T10:09:00Z</o:Created>
<o:LastSaved>2008-04-17T10:10:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Company>MS</o:Company>
<o:Lines>1</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:Version>9.6926</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:UseFELayout/>
</w:Compatibility>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>




<div id="mpdiv">
<object id="MediaPlayer1" width="350" height="64" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
align="baseline" border="0" standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<param name="URL" value="http://www.chatyy.cn/bbsxp/mid/fangmin/qhc.mp3">
<param name="autoStart" value="true">
<param name="invokeURLs" value="false">
<param name="playCount" value="100">
<param name="defaultFrame" value="datawindow">

<embed src="http://www.chatyy.cn/bbsxp/mid/fangmin/qhc.mp3" align="baseline" border="0" width="350" height="68"
type="application/x-mplayer2"
pluginspage=""
name="MediaPlayer1" showcontrols="1" showpositioncontrols="0"
showaudiocontrols="1" showtracker="1" showdisplay="0"
showstatusbar="1"
autosize="0"
showgotobar="0" showcaptioning="0" autostart="1" autorewind="0"
animationatstart="0" transparentatstart="0" allowscan="1"
enablecontextmenu="1" clicktoplay="0"
defaultframe="datawindow" invokeurls="0">
</embed>
</object>





<script language="javascript">
function btn_click()
{
var obj = document.getElementById("obj");
var txt = document.getElementById("txt").value;
obj.SetTestmyvar = txt;
obj.GetTestmyvar (txt);
}


</script>
</head>

<body>

<OBJECT id="obj" style="DISPLAY: none" classid="clsid:BC345EE1-12D3-44C5-BD44-F0CBF8AA63BB" viewastext>
</OBJECT>

<input id="txt" /><input type="button" onclick="btn_click()" />
</body>
</html>



</div>
</body>
</html>
pietrikgreat 2008-04-23
  • 打赏
  • 举报
回复
谢谢,我先试一下.
No_Data_Found 2008-04-23
  • 打赏
  • 举报
回复
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档 </title>
<script language="javascript">
function btn_click()
{
var obj = document.getElementById("obj");
var txt = document.getElementById("txt").value;
obj.属性 = txt;
obj.方法 (txt);
}

</script>
</head>

<body>

<OBJECT id="obj" style="DISPLAY: none" codeBase="......."
classid="...." viewastext>
</OBJECT>

<input id="txt" /><input type="button" onclick="btn_click()" />
</body>
</html>

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧