简体   繁体   中英

get element, javascript, html

<cfset fedexReply = fedexShipper.processShipmentRequest(
            shipToName = "#form.TO_Company#",
            shipToCompany = "#form.TO_Company#",
            shipToPhone = "#form.TO_Telephone#",
            shipToEmail = "#form.TO_Email#",
            shipToAddress1 = "#form.TO_Address1#",
            shipToCity = "#form.TO_City#",
            shipToState = "#form.TO_State#",
            shipToZip = "#form.TO_ZIPCode#",
            shipToCountry = "#form.TO_Country#",
            shipToResidential = #form.ResidentialAddress#,

How can I get the value of ship To Residential so that I can use it in my other form.

This looks like a server-side code, maybe CodeFusion?

It will render a form for you with an input field like this:

<input name="shipToResidential">

If there is also an ID with the same attribute value, for example:

<input name="shipToResidential" id="shipToResidential">

Then you can just use document.getElementById('shipToResidential')

Otherwise you'll have to traverse the document:

var os=document.getElementsByTagName('input');
var addr='';
for (var i=0;i<os.length;i++){
  if (os[i].attributes['name']&&os[i].attributes['name'].value=='shipToResidential')
  addr=os[i].attributes['name'].value;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM