我有一個與好看CSS樣式下面的代碼放在開關按鈕提交PHP代碼,當用戶選中一個複選框
<?php
$wifi2g=file_get_contents("wifi2g.txt");
$wifi2g= trim ($wifi2g);
?>
<link rel="stylesheet" type="text/css" href="style.css">
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" <?php if ($wifi2g == "enabled") {echo "checked";} ?>>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
我可以理解爲你wifi2g.txt看到並定義按鈕位置或關閉(選中或取消選中)。我有兩個腳本,我想上傳到ftp服務器wifion.php和wifioff.php。這些腳本取決於按鈕的位置。當用戶將按鈕位置設置爲ON(或選中)時,我想上傳wifion.php,並設置爲關閉或未選中時上傳wifioff.php。我怎樣才能做這項工作?我在這裏找到這個按鈕https://proto.io/freebies/onoff/
你必須使用的JavaScript。 – Barmar