javascript var into input value
can someone help me out getting a javascript var inside the value of a form input value?
I'm a newbie in javascript but can give you开发者_开发知识库 my solution in php. ("Just use php" isn't an option because it have to be client-based :D )
<?php
$value = "Hello!";
?>
<form name="settings" action="">
<input name="color" value="<?php echo $value; ?>" />
</form>
Thanks in advance
Like this:
document.forms["settings"].color.value = "your value goes here...";
<?php
$value = "Hello!";
?>
<form name="settings" action="">
<input name="color" value="" />
</form>
<script>
document.forms["settings"].color.value = "<?php echo $value;?>";
</script>
精彩评论