淘宝搜索代码是什么?想要在自己的网站和论坛上搜索淘宝商品

JavaScript014

淘宝搜索代码是什么?想要在自己的网站和论坛上搜索淘宝商品,第1张

把此代码加入到网站或者支持代码的博客中就可以使用搜索功能了,

注意:此代码如果加入到网站和论坛上要把网站上传到服务器中才能看的到 在自己电脑上是显示空白的 教你一个小窍门:用火狐浏览器《Mozilla Firefox》可以在自己电脑中浏览搜索框

<script type='text/javascript'>

alimama_pid='mm_12515780_0_0'

alimama_type='g'

alimama_tks={}

alimama_tks.style_i=1

alimama_tks.lg_i=1

alimama_tks.w_i=572

alimama_tks.h_i=69

alimama_tks.btn_i=1

alimama_tks.txt_s=''

alimama_tks.hot_i=1

alimama_tks.hc_c='#999999'

alimama_tks.c_i=1

alimama_tks.cid_i=0

</script>

<script type='text/javascript' src='http://a.alimama.cn/inf.js'></script>

在奉献一个代码 淘宝热销商品大全

<iframe frameborder="0" marginheight="0" marginwidth="0" border="0" id="alimamaifrm" name="alimamaifrm" scrolling="no" height="3347px" width="100%"src="http://gouwu.alimama.com/channel/channelCode.htm?pid=mm_12515780_0_0"></iframe>

还有百度搜索框代码

<iframe id="baiduframe" marginwidth="0" marginheight="0" scrolling="no"

framespacing="0" vspace="0" hspace="0" frameborder="0" width="400" height="90"

src="http://unstat.baidu.com/bdun.bsc? tn=123zsgh85a_pg&cv=0&cid=1185428&csid=242&bgcr=ffffff&ftcr=000000&urlcr=0000ff&tbsz=335&sropls=1,2,3,4,5,6&defid=2&kwgp=0">

</iframe>

先去淘宝联盟获取搜索的代码,有几个选择项,选好之后,把获取到的代码放入你想放的地方就行了.

放的时候,比如你加一篇文章,编辑文章的编辑器有个按钮是可以切换成代码的,你在代码模式下,把获到的代码放入进去,提交,再打开你的文章就可以看到搜索框了.别人通过这个搜索框搜索并购买了东西就会给你佣金.

淘宝是我们经常用的一个网上购物平台,打开淘宝网首页,找到淘宝首页的搜索框,如下如所示:

大家可以看到,当页面一打开,搜索框中就可以看到灰色字体“少女高跟鞋”,还有闪烁的光标。当用户点击输入的时候,灰色字消失。当用户清空文本框的所有内容的时候,灰色字自动恢复。

接下来,这个小案例就是要介绍如何实现这种效果,即用户输入事件。

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>判断用户输入事件第2遍oninput 和onpropertychange 的用法</title></head><style>.search { width:300pxheight: 30pxmargin: 100px autoposition: relative} .search input { width:200pxheight:25px} .search label { font-size: 12pxcolor:#cccposition: absolutetop:8pxleft:10pxcursor: text} </style><script type="text/javascript">业务逻辑分析: // 1.内容为空时,光标和默认字显示在搜索框。自动获取焦点 // 2.当输入内容时,默认字消失。用oninput事件 window.onload = function () { function $(id){ return document.getElementById(id)} $("txt").focus()//自动获取光标方法 $("txt").oninput = $("txt").onpropertychange = function () { //oninput 大部分浏览器支持 检测用户表单输入内容 //onpropertychange ie678 检测用户表单输入内容 if ( this.value == ""){ // 首先判断文本框里的值是否为空。注意用双等号! $("message").style.display = "block"} else { $("message").style.display = "none"