如何從輸入元素的id中獲取元素並將其作爲參數傳遞給java腳本函數,如何將其傳遞給 。如何在Javascript中傳遞元素Id作爲參數或參數
<html>
<body>
<input type="text" id="name">
<input type="button" onclick="call(id_of_input_type_text)" value="Click
me">
<script>
var call(id_of_input_type_text) = function(){
var x = document.getElementById(id_of_input_type_text).value;
alert(x);
}
</script>
</body>
</html>
先生/媽媽我想用單一功能如驗證,並得到由函數通ID存在價值,所以請幫助我關於這個問題
非常感謝主席先生 –
它是非常有用的,先生,並再次感謝分享這方面的知識 –