开发者

javascript var into input value

开发者 https://www.devze.com 2023-03-13 18:22 出处:网络
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.

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消