1.html
<a href='2.htm?tt=123456'>asdasdasda</a>2.php
<html>
<head>
<script language="JavaScript">
str=document.URL;
eval(str.replace(/^.+\?(.+)$/,'$1'));
alert(tt);
document.getElementsByTagName("title")[0].value = tt;
</script>
</head>
<body>
<input name="title" type="text" disabled="disabled">
</body>
</html>现在我要在传参到2.php的时候同时赋值给name叫title的文本框自动填上123456这个变量?
<a href='2.htm?tt=123456'>asdasdasda</a>2.php
<html>
<head>
<script language="JavaScript">
str=document.URL;
eval(str.replace(/^.+\?(.+)$/,'$1'));
alert(tt);
document.getElementsByTagName("title")[0].value = tt;
</script>
</head>
<body>
<input name="title" type="text" disabled="disabled">
</body>
</html>现在我要在传参到2.php的时候同时赋值给name叫title的文本框自动填上123456这个变量?
<input name="title" type="text" disabled="disabled" value="<?php echo $_GET['tt']?>">
htm<html>
<head></head>
<body>
<input name="title" type="text" disabled="disabled">
<script language="JavaScript">
var tt=/tt=([^&]+)/i.exec(location.search);
if(tt)tt=tt[1];else tt='';
alert(tt);
//赋值代码放到title控件下面,放到上面会找不到控件而出错,因为还没生成控件
document.getElementsByTagName("title")[0].value = tt;
</script>
</body>
</html>
htm
在PHP里面是不是这样写?就两个参数都赋值给了两个不同的文本框?<input name="title" type="text" disabled="disabled" value="<?php echo $_GET['tt']?>"><input name="title2" type="text" disabled="disabled" value="<?php echo $_GET['aa']?>">