动态编辑隐藏的输入类型元素的值 [英] Edit the value of a hidden input type element dynamically

查看:78
本文介绍了动态编辑隐藏的输入类型元素的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<html>
<head>
<meta name="datetime" content="Date09-09-2011-Time10-07-16">
<script type="text/javascript" language="javascript">
function GetValue()
{
var arrayOfAnchors = document.all.tags("meta");
var value1 = arrayOfAnchors[0].content;
document.getElementById('final').value= value1;
}
</script>
</head>

<body>
<form method="post" action="NewPhpWriteFile.php">
<input type="hidden" id = "final" name="sometext" value= "Hello Sir" >
<input type="submit" name = "submit" id="btnClick" value="Click Me" onclick="GetValue()"/>
</form>
</body>
</html>



这是NewPhpWriteFile.php



This is the NewPhpWriteFile.php

if (isset($_POST['sometext']))
{
	$myFile = "testFile.txt";
	$thetext=$_POST['sometext'];
	writemyfile($myFile,$thetext,"w");
	parent.focus();
} else
{
	$thetext="Enter text here";
}
?>



当我执行文件并单击按钮"Click Me"时,仅将字符串"Hello Sir"传递到新文件"NewPhpWriteFile",在将id"final"的值传递给新文件之前,不会对其进行更新php文件.

有人可以建议我出什么事了吗?还有其他方法吗?



When i execute the file, and click the button "Click Me", only the string "Hello Sir" is passed to the new file "NewPhpWriteFile", the value of id "final" is not getting updated before it is passed to the new php file.

Can some one suggest me whats going wrong? Is there any other way to do this?

推荐答案

_POST ['
_POST['sometext'])) {


myFile = " ;
myFile = "testFile.txt";


thetext =
thetext=


这篇关于动态编辑隐藏的输入类型元素的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆