如何将当前网址设置为表单值。在这里,我使用两种形式,两种形式在编码方面都一样,例如id类等。我想将网址加载到两种形式。
当前我正在使用windows.onload函数,它仅适用于第一种形式,不适用于第二种形式。我想将网址加载到两种形式。
let providerToBeAssigned = self.providersArray[indexPath.item]
let providerToBeAssignedCKRef = self.findProviderCKRecordBasedOnProviderObject(provider: providerToBeAssigned)
var roomToBeReferenced: CKRecord {
let object = self.roomsAsCKRecsArray.filter {$0.recordID == self.selectedRoomCKRecID}
let value = object.first
return value!
}
if self.providerToBeRemoved != nil {
self.providerToBeRemoved![RecordTypes.providerEnum.assignedRoom] = nil
}
providerToBeAssignedCKRef![RecordTypes.providerEnum.assignedRoom] = CKRecord.Reference(record: roomToBeReferenced, action: .none)
let operation = CKModifyRecordsOperation(recordsToSave: [providerToBeAssignedCKRef!, self.providerToBeRemoved!], recordIDsToDelete: nil)
operation.savePolicy = .changedKeys
operation.completionBlock = {
print("record reference updated to cloud")
}
LaborFloorNamesDB.share.publicDatabase.add(operation)
我的表格是
<script type="text/javascript">
window.onload=function()
{
document.getElementById('emd_ticket_page_link').value = window.location.href;
}
</script>
答案 0 :(得分:0)
HTML要求ID唯一。
将'emd_ticket_page_link'
ID的第二个实例更改为唯一的内容,然后在其上调用document.getElementById(new_id).value = window.location.href;
答案 1 :(得分:0)
window.load无法解决此问题。所以我终于使用了这段代码。
$pageurlform = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ?
"https" : "http") . "://" . $_SERVER['HTTP_HOST'] .
$_SERVER['REQUEST_URI'];