php生成网页中的按钮链接怎么写?
例如这样,但是会报错,不知道怎么该.大家帮忙一下
<?php
echo'<html>
<body leftmargin="2" topmargin="2" marginwidth="2" marginheight="2">
<div align="center">
<p> </p>
<p> </p>
<p><img src="images/error.gif" width="128" height="128"></p>
<p><font color="#FF0000" size="4" face="黑体"><strong>错误!请返回</strong></font> </p>
<input type="button" value="返回首页" onclick="location.href='index.php'">
</div>
</body>
</html>';
?>
问题点数:20、回复次数:8Top
1 楼fzjw(冰凌尘埃)回复于 2004-09-03 10:11:19 得分 0
echo <<<HTML
<html>
<body leftmargin="2" topmargin="2" marginwidth="2" marginheight="2">
<div align="center">
<p> </p>
<p> </p>
<p><img src="images/error.gif" width="128" height="128"></p>
<p><font color="#FF0000" size="4" face="黑体"><strong>错误!请返回</strong></font> </p>
<input type="button" value="返回首页" onclick="location.href='index.php'">
</div>
</body>
</html>
HTML;Top
2 楼nnnjjj(八仙过海)回复于 2004-09-03 10:12:13 得分 0
加javascript试试:
<input type="button" value="返回首页" onclick="javascript:location.href='index.php'">
Top
3 楼fzjw(冰凌尘埃)回复于 2004-09-03 10:13:40 得分 10
发现一个错误:
onclick="location.href='index.php'"
应为:
onclick='window.location="index.php"'Top
4 楼hancheng(hancheng)回复于 2004-09-03 10:14:36 得分 0
一个Form一个提交按键即可。Top
5 楼uptoyou(uptoyou)回复于 2004-09-03 10:30:10 得分 0
我的机器上这两个都可以用
onclick="location.href='index.php'"
应为:
onclick='window.location="index.php"'
请问他们有什么区别吗?
Top
6 楼xuzuning(唠叨)回复于 2004-09-03 10:41:02 得分 10
两者一样
不过一般
取的页面的url用window.location.href
设置页面的url用window.location = ...
这样用看上去好一点
Top
7 楼snmr_com(麒麟厍人)回复于 2004-09-03 10:47:58 得分 0
单引号里面还有单引号,当然报错啦Top
8 楼programdolt(我普普通通,我是个杀猪的)回复于 2004-09-03 14:24:32 得分 0
单引号里面还有单引号,当然报错啦
Top




