How to use HTML forms without a server

后端 未结 6 474
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-14 08:49

I am not a web-developer and want to understand the better way to pass variables. In the past I have used various ways to pass things to java script functions. I have never

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 09:01

    You wouldn't pass the parameters. You could have "onsubmit" call a javascript function, and then within the function use javascript to access the actual controls that the user has selected. You could use the GetElementById function to retrieve a certain element, and then determine the value of that element.

    If all you wanted to do was change the background color, you could use javascript to change the backgroundColor property of the body tag or any tag on the page.

    You'd have to remember to return false from your function, though -- otherwise, the form would be submitted.

提交回复
热议问题