gpt4 book ai didi

javascript - 将值(value)转化为形式

转载 作者:行者123 更新时间:2023-11-28 16:29:53 24 4
gpt4 key购买 nike

我有以下代码:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:hi="http://www.******.nl" version="1.0">

<xsl:output method="html" indent="yes" />
<xsl:param name="bdr" />
<xsl:param name="intsrtlg" />
<xsl:param name="intsrtgr" />
<xsl:param name="var1" />
<xsl:param name="t" />
<xsl:param name="oms" />

<xsl:template match="/">

<script language="Javascript">
function addCart(artNr){
document.cartForm.artNr.value = artNr;
document.cartForm.aantalArts.value = aantalArts;
document.cartForm.submit();
}
</script>
<div style="margin-left:10px"><span class="bestelart">B</span> = Bestelartikel</div>
<table border="0" cellspacing="10" cellpadding="0" class="kop_toppers" width="100%">
<tr><td width="50">Art.Nr.</td><td width="400">Omschrijving</td><td width="25">VP</td><td width="100" align="center">Prijs (ex. btw)</td><td width="50">Aantal</td><td width="75"></td></tr></table>
<table border="0" cellspacing="5" cellpadding="0" width="100%">
<xsl:for-each select="//regels/item">
<xsl:value-of select="hi:getKop()" disable-output-escaping="yes" />
<td valign="top" height="100%">
<table cellspacing="2" cellpadding="0" class="toppersTable" width="100%" height="100%"><tr>

<td width="50"><xsl:value-of select="veld[3]" /><span class="bestelart"><xsl:value-of select="veld[34]" /></span></td>
<td width="400px"><span class="bold">
<xsl:value-of select="hi:replOms(string(veld[4]))" />
<xsl:value-of select="hi:replOms(string(veld[5]))" />
<xsl:value-of select="hi:replOms(string(veld[6]))" />
</span></td>
<td width="25">(<xsl:value-of select="veld[9]" />)</td>
<td align="center" width="100"><span class="prijsEx"><xsl:text disable-output-escaping="yes">&amp;</xsl:text>euro;<xsl:value-of select="veld[7]" /></span></td>
<td width="50"><input type="text" size="3" value="1" name="aantalArts" id="aantalArts" class="infoButton" /></td>
<td width="75"><input type="button" value="Bestellen" class="infoButton" onclick="addCart('{veld[3]}'),**FIELD**" /></td>
</tr>
</table>
</td>
<xsl:value-of select="hi:getBottom()" disable-output-escaping="yes" />
</xsl:for-each>
</table>

<form name="cartForm" method="post" action="addcart.asp">
<input type="hidden" name="act" value="add" />
<input type="hidden" name="artNr" value="" />
<input type="hidden" name="aantalArts" value="" />
</form>

</xsl:template>
<msxsl:script language="JScript" implements-prefix="hi">
<![CDATA[

function getMonth(){
var maanden = ["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"];
var d = new Date();
var month = maanden[d.getMonth()].toUpperCase();
return month;
}

var teller = 0;
function getKop(){
var returnStr = '';
if(teller==0){
returnStr = '<tr>';
}
teller++;
return returnStr;
}

function getBottom(){
var returnStr = '';
if(teller==1){
returnStr = '</tr>';
teller=0;
}
return returnStr;
}

function replOms(oms){
oms = oms.replace(/&#160;/g," ");
return oms;
}
]]></msxsl:script>

</xsl:stylesheet>

如何将输入值AantalArts放入标有**FIELD**的地方?

最佳答案

使用评论中的 XSLT 信息和函数的正确拼写进行了更新

您可以使用document.getElementById() .

<input type="text" size="3" value="1" name="aantalArts_{position()}" id="aantalArts_{position()}" class="infoButton" />
<input type="button" value="Bestellen" class="infoButton" onclick="addCart('{veld[3]}', document.getElementById('aantalArts_{position()}').value)" />

关于javascript - 将值(value)转化为形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6455292/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com