Javascript获取select的选中值和选中文本

  每次用都上网找,就是没记住 哎,老了 这次干脆摘到博客上吧 以后再找起来方便

var obj = document.getElementById(”select_id”); //selectid

var index = obj.selectedIndex; // 选中索引

var text = obj.options[index].text; // 选中文本

var value = obj.options[index].value; // 选中值


( ! ) Warning: Missing argument 1 for cwppos_show_review(), called in /data/www/enjoyphp/wp-content/themes/flat/content-single.php on line 29 and defined in /data/www/enjoyphp/wp-content/plugins/wp-product-review/includes/legacy.php on line 18
Call Stack
#TimeMemoryFunctionLocation
10.0001354856{main}( ).../index.php:0
20.0002355144require( '/data/www/enjoyphp/wp-blog-header.php' ).../index.php:17
30.368510178560require_once( '/data/www/enjoyphp/wp-includes/template-loader.php' ).../wp-blog-header.php:19
40.369210249704include( '/data/www/enjoyphp/wp-content/themes/flat/single.php' ).../template-loader.php:74
50.419110799848get_template_part( ).../single.php:5
60.419110800368locate_template( ).../general-template.php:167
70.419110800464load_template( ).../template.php:643
80.419210800848require( '/data/www/enjoyphp/wp-content/themes/flat/content-single.php' ).../template.php:686
90.422010785600cwppos_show_review( ).../content-single.php:29

1 评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注