我有一个 input type="text" 字段我想从中获取 value 属性,但条件是输入标签的 id 必须包含“PlaceHolderSearchArea”这个词
输入字段的html是这样的
<input name="ctl00$PlaceHolderSearchArea$SearchBox$S633C1122_InputKeydummywords" type="text" value="something something" maxlength="200" id="ctl00_PlaceHolderSearchArea_SearchBox_S622C1022_InputKeywords" accesskey="S" title="something..." class="ms-sbplain" alt="something..." onkeypress="javascript: return S633C1122_OSBEK(event);" onfocus="if (document.getElementById('ctl00_PlaceHolderSearchArea_SearchBox_ctl04').value =='0') {this.value=''; if (this.className == 's4-searchbox-QueryPrompt') this.className = ''; else this.className = this.className.replace(' s4-searchbox-QueryPrompt',''); document.getElementById('ctl00_PlaceHolderSearchArea_SearchBox_ctl04').value=1;}" onblur="if (this.value =='') {this.value='Enter Search Term'; if (this.className.indexOf('s4-searchbox-QueryPrompt') == -1) this.className += this.className?' s4-searchbox-QueryPrompt':'s4-searchbox-QueryPrompt'; document.getElementById('ctl00_PlaceHolderSearchArea_SearchBox_ctl04').value = '0'} else {document.getElementById('ctl00_PlaceHolderSearchArea_SearchBox_ctl04').value='1';}" style="width:170px;" />
有人可以建议一个正则表达式来实现这一点