嗨, $form
持有該...php DOMDocument:表單元素的完整轉換?包裝和刪除?
<form method="post" action="">
<input type="hidden" name="ip" value="127.0.0.1">
<label for="s2email">Your Email</label>
<input type="text" name="email" id="s2email" value="email..." size="20" onfocus="if (this.value == 'email...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'email...';}">
<input type="submit" name="subscribe" value="Subscribe">
<input type="submit" name="unsubscribe" value="Unsubscribe">
</form>
因爲我不知道什麼是可能與DOMDocument
類,我需要尋求幫助。 我實際上有兩件事情需要在上面的$ form上轉換。
1.)label-s2email and its input#sd-email
應該被包裝在一個<div class="name">
是甚至可以選擇這兩個(通過id或for-attribute)並將這兩個包裝到一個div?
2.)是否可以使用php刪除onfocus和onblur屬性?
感謝你的幫助
*(相關)* [最佳方法解析HTML](http://stackoverflow.com/questions/3577641/best-methods-to-parse-html/3577662#3577662)和[關於'DOMDocument'的Noob問題在PHP中](http://stackoverflow.com/questions/4979836/noob-question-about-domdocument-in-php/4983721#4983721) – Gordon 2011-03-24 09:27:14