Hi everyone
Was wondering if some could help me with this cuz I’m pulling my hair out (Javascript newbie).
I have a form (below) and I need to use Javascript to change the name of one of the hidden fields when the page loads. This updated value will then be added to the URL on form submit to tell our server that Javascript is enabled.
I have been digging through some Javascript books I have and just need someone to help me put it all together. This is what I have so far:
<head>
<script type="text/javascript">
function updateValue() {
var findField = document.getElementByID('js');
var findField.value = "on";
}
window.onload = updateValue;
</script>
</head>
<body>
<form action="http://www.xyz.com/filename.aspx?action=[define]&text=[text]&searchlang=[searchlang]&deflang=[deflang]&product=[product]&searchtype=[searchtype]&js=[js]" method="get">
<input type="hidden" name="action" value="define" />
<input type="hidden" name="searchlang" value="english" />
<input type="hidden" name="deflang" value="english" />
<input type="hidden" name="product" value="xxx" />
<input type="hidden" name="searchtype" value="stemming" />
<input type="hidden" name="js" value="off" id="js" />
<label for="text">Search</label>
<input type="text" size="20" id="text" name="text" />
<input type="submit" value="search" size="5" class="button" />
</form>
Okay, so as you can see, I’m trying to change the value of the input with the an ID of “js”
Any help would be greatly appreciated.
Thanks
Mike