javascript之经常遇到的问题

1、如何判断一个值是否为空

   str.length==0

2、html用图片做提交按钮

  • <td><button onclick="document.from.Submit()"><img src="img/register_btn_over.gif" /></button></td>
  • 最佳:<td> <input type=image height=31 width=143 src="img/register_btn_over.gif" onclick="this.form.submit()" ></td>
  • <td><input type="submit" style="background:url(img/register_btn_over.gif); width:143px; height:31px; border:0; padding:0;" value="" /></td>

3、联动时清空第二个下拉列表

(加载的第一个下拉列表的方法放在body中)

  • 第二个名字.innerHTML="";
  • 第二个名字.option.length=1;

猜你喜欢

转载自blog.csdn.net/weixin_42496678/article/details/81949826