<div class="codetitle"> <span><a style="CURSOR: pointer" data="12575" class="copybut" id="copybut12575" onclick="doCopy('code12575')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code12575"> <br><script src="jquery-1.9.1.js" type="text/javascript"></script> <br><script type="text/javascript"> <BR>$(function () { <BR>var ping = ''; <BR>switch ($('#Select3 option:selected').text()) { <BR>case '图片': ping += '<img '; break; <BR alt="jquery自定义属性(类型/属性值)_jquery" >case '文本框': ping += '<input type=text'; break; <BR>case '按钮': ping += '<input type=button'; break; <BR>} <BR>$('#attrzhi').blur(function () { <BR>ping += ' '; <BR>ping += $('#Select2 option:selected').text(); <BR>ping += '='; <BR>ping += $('#attrzhi').val(); <BR>}) <BR>$('#Button1').click(function () { <BR>ping += '/>'; <BR>alert(ping); <BR>$('#show').append(ping); <BR>}) <br><br>}) <BR></script> <br> <br> <br><form id="form1" runat="server"> <br><div> <br><table> <br><tr> <td> <!--什么东西--> 添加类型:</td> <td><select id="Select3"> <br><option>图片</option> <br><option>文本框</option> <br><option>按钮</option> <br></select></td> <td rowspan="5" id="show"></td> </tr> <br><tr> <td> <br><!--需要设置的属性值--> <br>属性:</td> <td> <select id="Select2"> <br><option>src</option> <br><option>width</option> <br><option>height</option> <br><option>title</option> <br><option>value</option> <br><option>font-size</option> <br><option>color</option> <br></select> <br> </td> </tr> <br><tr> <td>属性值:</td> <td><input id="attrzhi" type="text"></td> </tr> <br><tr><td colspan="2"><div id="showattr"></div></td></tr> <br><tr> <td> 内容:</td> <td><input id="Text1" type="text"></td> </tr> <br><tr><td> <br><input id="Button1" type="button" value="创建"> </td></tr> <br> </table> <br> </div> <br> </form> <br> <br> </div>