如题,我想做一个按钮,按钮的显示文字为:This is a red apple, it is a fruit.需要传递的数值为apple。
<form action="Page2.php" method="post" target="_blank"><input name="value" id="value" type="hidden" value="apple"/><input type="submit" value="This is a red apple, it is a fruit."/></form>
由于行宽有限,按钮上显示的文字要换成2行才能完全显示:This is a red apple,
it is a fruit.如何设置按钮属性使文字自动换行?估计这个比较勉强。
所以,是否可以使用a href 来post数值?请给段代码实例。
谢谢。
<form action="Page2.php" method="post" target="_blank"><input name="value" id="value" type="hidden" value="apple"/><input type="submit" value="This is a red apple, it is a fruit."/></form>
由于行宽有限,按钮上显示的文字要换成2行才能完全显示:This is a red apple,
it is a fruit.如何设置按钮属性使文字自动换行?估计这个比较勉强。
所以,是否可以使用a href 来post数值?请给段代码实例。
谢谢。
<form action="Page2.php" method="post" target="_blank">
<input name="apple" id="value" type="hidden" value="This is a red apple, <br>it is a fruit."/>
<input type="submit" value="This is a red apple, it is a fruit."/>
</form>//Page2.php
<?php
echo $_POST['apple']; //在上面中加个<br> 就是让他换行
?><a href="Page2.php?apple=This is a red apple, <br>it is a fruit.">
//Page2.php
<?php
echo $_GET['apple']; //跟在链接后面的要用$_GET 来取
?>
function test() {
$.ajax({
type: "POST",
url: "Page2.php",
data: "value=apple",
success: function(msg){
alert( "sucess post: " + msg );
}
});
}</script>
将, 替换成,