Javascript 如何使用节点在文本框中设置值?
如何使用节点在文本框中设置值Javascript 如何使用节点在文本框中设置值?,javascript,jquery,html,Javascript,Jquery,Html,如何使用节点在文本框中设置值 var tot = parseFloat(parseFloat(shortageval) - parseFloat(singval)).toFixed(3); $($this).parents('tr').prevAll('tr').find('id=sishr11').innerhtml=tot; 请帮忙 我想这可以帮助你 <?php $doc = new DOMDocument(); $doc->load( 'sample1.xml' ); $mu
var tot = parseFloat(parseFloat(shortageval) - parseFloat(singval)).toFixed(3);
$($this).parents('tr').prevAll('tr').find('id=sishr11').innerhtml=tot;
请帮忙 我想这可以帮助你
<?php
$doc = new DOMDocument();
$doc->load( 'sample1.xml' );
$musiclist = $doc->getElementsByTagName( "song" );
foreach( $musiclist as $song )
{
$artists = $song->getElementsByTagName( "artist" );
$artist = $artists->item(0)->nodeValue;
}
?>
<input type="text" id="artist" name="artist" value="<?php echo $artist; ?>"tabindex="1"/>
这是XML Sample.XML
<?xml version="1.0" encoding="utf-8"?>
<musiclist>
<song>
<title></title>
<artist></artist>
<url></url>
</song>
</musiclist>
这取决于HTML结构,您可能还需要提供它。但是,请尝试将.innerhtml=tot替换为.htmlot,因为find返回的是数组而不是DOM元素。$$this?还是$this?$$this?这是我唯一使用的duse.valtot.Textbox值$$this.parents'tr'.prevAll'tr'.find'[id=sishr11]'.valtot;您可以将代码简化为$'sishr11'.valtot,因为ID必须是唯一的。