m1net.cn's profilem1net ™PhotosBlogLists Tools Help
    10/26/2005

    脚本系列之八(插入背景音乐和视频)

     

    通过这两个脚本可以方便不熟悉html的朋友地插入背景音乐和视频。

    背景音乐和视频支持设置播放次数的设置。

    由于背景音乐没有占位符,无法选中,因此删除背景音乐只能通过html编辑模式删除相应的代码来实现。
     

    使用方法如下:

    1 插入背景音乐

    javascript:document.all("rtebox").getElementsByTagName("div")[2].focus();var s=document.selection.createRange();var d=window.prompt("请输入音频文件地址:","http://");if (d!=null) {var l=window.prompt("请输入播放次数[-1表示一直播放]:","-1"); if (l!=null) {void(s.pasteHTML("<IMG dynsrc=\""+d+"\" loop="+l+" width=0 height=0>"));alert("增加背景音乐成功,请预览效果!");}}

    2 插入视频

    javascript:document.all("rtebox").getElementsByTagName("div")[2].focus();var s=document.selection.createRange();var f="http://";var n="-1";var u=1;try {void(f=s.item(0).dynsrc);void(n=s.item(0).loop);}catch(e){void(u=0);}var d=window.prompt("请输入视频文件地址:",f);if (d!=null) {var l=window.prompt("请输入播放次数[-1或者infinite表示一直播放]:",n); if (l!=null) {if (u==0) void(s.pasteHTML("<IMG dynsrc=\""+d+"\" loop="+l+">")); else {void(s.item(0).dynsrc=d);void(s.item(0).loop=l);}}}

    【方法一】

    进入日志编辑的设计状态下(非HTML状态),将上面的脚本代码复制到地址栏,回车即可。选择视频运行该脚本为修改视频设置。

    【方法二】

    将该脚本一次性地收藏到收藏夹,以后只要进入日志编辑的设计状态下(非HTML状态),单击收藏夹该链接即可。选择视频运行该脚本为修改视频设置。

    加入到收藏夹的方法:

    1 打开IE,不考虑是什么页面,将当前页面加入到收藏夹,名称自己任意起,比如"InsertAudio","InsertVideo"。

    2 复制上面的脚本代码。

    3 在收藏夹中刚才收藏的那个链接上单击鼠标右键,选择"属性",弹出新窗口,将脚本粘贴到"URL"后面的文本框中,单击"确定"按钮,会出现询问你"是否保留这一目标"的对话框,选择"是"即可。

     

    【注意】本脚本在IE6.0下运行测试通过,在其他浏览器上不能保证正常运行。

     

    感谢 爬山虎 提供

    Comments (37)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    蕾 Ashleywrote:
    我按照要求添加了歌曲的链接,也还是不行啊~请指导!:)
    Feb. 8
    蓝贝wrote:
    预览效果后,没音乐出来啊!是我那里搞错了吗!教一下啊!xiexie !
    Apr. 11
    feiwrote:
    好难啊.
    Apr. 4
    晶 虢wrote:
    感想同上啊``
     
     
    Mar. 31
    莉 张wrote:
    谢谢了,相当成功地连接了音乐了。。。
    Mar. 14
    非HTML状态是什么意思,我复制了地址栏中,但是没有显示
     
    Mar. 12
    wxwrote:
    Thanks!
    Mar. 10
    hebe huangwrote:
    成功了
    Mar. 10
    春华 张wrote:
    真的是不明白??
    这些代码要怎么添加到自己的网络日志里,
    还有就是怎么换歌的呢
    Mar. 4
    Picture of Anonymous
    MiniFox wrote:
    请教啊~怎样设置可以连续播出多首音乐呀?
    Feb. 22
    有時出現,
    有時又沒出現><"
    在編輯模式又會出現,
    又或者出現一次
    按重新整理又不會顯現
    為什麼呢..?
    那裡沒設定對呢?
    求你救救我吧
    Feb. 15
    Picture of Anonymous
    demi wrote:
    地址拦在哪啊
    Jan. 26
    Picture of Anonymous
    ┕┄→ping小草莓 wrote:
    第一个好像不行啊~还是没有音乐~
    Jan. 25
    Picture of Anonymous
    俺还是农民 wrote:
    我是农民我看不懂啊。
    Jan. 20
    Picture of Anonymous
    樱之翼羽 wrote:
    预兰效果后,怎么没有音乐出来啊
    Jan. 17
    Picture of Anonymous
    神奇小队长 wrote:
    回车但没反应
    Jan. 15
    Picture of Anonymous
    yhl84612 wrote:
    我也看不懂!求助!!!
    Dec. 30
    Picture of Anonymous
    我爱跑步 wrote:
    看不懂啊,能不能说的简单点啊,拜托了,呵呵
    Dec. 7
    Picture of Anonymous
    ōべ小静ōべ wrote:
    不行啊.不懂怎么做啊!!快帮帮我啊!!!谢谢了!!
    Dec. 3
    Picture of Anonymous
    ヤ尐吖╭ァ头 wrote:
    我也看不明白,好迷茫哦
    Dec. 2

    Trackbacks

    The trackback URL for this entry is:
    http://m1net.spaces.live.com/blog/cns!B5C2D0CE61E22862!28700.trak
    Weblogs that reference this entry
    • None