Delphi在Webbrowser中插入 HTML/java script代码
使用方法将下面的代码赋值到1个记事本里保存,然后保存为xxx.htm就可以看到效果
使用PasteHtml实现功能
的事件
- Windows Media播放器 mp3 mp4
- Windows Real Player
- Flash Player
- Mid背景音乐
- 图片
的方法
( (WebBrowser1.Document as IHTMLDocument2).selection.createRange as
IHtmlTxtRange).pasteHTML(Memo1.Text);
注意 划删除线的表示使用这个函数无效果
播放Mid背景音乐 src为Midi文件名,loop=-1为无限回放,1为一次,2为两次......
<HTML><HEAD>
<bgsound src=C:\1.mid loop=-1</HEAD>
<body></body></HTML>
Windows Media播放器 支持播放 *.mp3 *.avi *.mp4 *.mov *.wmv *.wav *.mid *.wma *.m3u *.mpeg *.csf *.asf *.3gp
<object style="WIDTH: 480px; HEIGHT:
360px" ID="nsPlayer" classid="clsid:05589FA1-C356-11CE-BF01-00AA0055595A">
<PARAM NAME="FileName" VALUE=C:\1.mp3 />
<PARAM NAME="AutoStart" VALUE="1" />
<PARAM NAME="ShowDisplay" VALUE="0" />
</OBJECT>
Windows Media播放器 支持格式 *.mp4
*.avi 不支持.mp3
</STYLE>
</HEAD><BODY>
<DIV>
<EMBED
width=400
height=200
type=application/x-oleobject
codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701
src=file://C:/1.avi
autostart="false"
flename="mp">
</EMBED></EMBED></EMBED>
</DIV></BODY>
</HTML>
//支持格式 *.rm *.avi
<EMBED
height=360
width=480
src="c:\1.avi"
type=audio/x-pn-realaudio-plugin
autostart="False"
controls="ControlPanel">
</embed>
//支持格式 *.rm *.avi
</HEAD><BODY>
<EMBED
width=480
height=360
type=audio/x-pn-realaudio-plugin
src="C:\1.avi"
autostart="true"
console="cons"
controls="ImageWindow">
</EMBED>
</BODY></HTML>
//插入Flash播放器
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="480" height="360" title="saxs">
<param name="movie" value="c:\1.swf" />
<param name="play" value="false" />
<param name="quality" value="high" />
<param name="allowscriptaccess" value="always" />
<param name="allowfullscreen" value="true" />
</object>
<param name="movie" value="c:\1.swf" />
<param name="play" value="false" />
<param name="quality" value="high" />
<param name="allowscriptaccess" value="always" />
<param name="allowfullscreen" value="true" />
</object>