plz help me.
I found the error when i run it. For my propose, i want to sent values to function when click links and show a value that has sent into textbox. I had made two links for testing passing value to function but it didn’t work it don’t sent value to “loadToTextBox” function.
Please help me for solving this problem ~-_-~.
Thank in advance
From Aranyuth
//////////////////it don’t work, i want to do like this/////////////////////
<html>
<script language=”javascript”>
<!–
function loadToTextBox(code, bg_or_font) {
if(bg_or_font == “bg”) {
document.submitColor.bg_code.value = code;
}else{
document.submitColor.font_code.value = code;
}
}
//–>
</script>
//
<!–<body OnLoad=loadToTextBox(‘ff’)>–>
<body>
<form method=”post” action=”” name=”submitColor”>
<input type=”text” name=”bg_code”>
<input type=”text” name=”font_code”>
</form>
//first links for testing
<a href=”javascript:loadToTexBox(‘ff’, ‘bg’)”>000000</a>
//second links for testing
<a href=”choose_bg_font_color.html” OnClick=loadToTexBox(‘ff’, ‘bg’);”>000001</a>
</body>
</html>
//////////////////////////////////////////////////
//////////////////it it like this, it work why?? ///////////
// i’m confuse
<html>
<script language=”javascript”>
<!–
function loadToTextBox(code) {
document.submitColor.bg_code.value = code;
}
//–>
</script>
//
<body OnLoad=loadToTextBox(‘ff’)>
<form method=”post” action=”” name=”submitColor”>
<input type=”text” name=”bg_code”>
<input type=”text” name=”font_code”>
</form>
//first links for testing
<a href=”javascript:loadToTexBox(‘ff’, ‘bg’)”>000000</a>
//second links for testing
<a href=”choose_bg_font_color.html” OnClick=loadToTexBox(‘ff’, ‘bg’);”>000001</a>
</body>
</html>
///////////////////////////////////////