Two questions

MyPlanet 2003-08-24 05:11:29
1) Is it possible to get the value of txtUserName in test.html page?
<FORM name="frmFirst" method="post" action="test.html">
<input type="text" name="txtUserName" size="33" >
</FORM>


2) Why following including doesn't work in the html page? The path and filename are both correct.
<script language="javascript" src="../includes/toolbag.js"></script>
...全文
93 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
MyPlanet 2003-08-26
  • 打赏
  • 举报
回复
It is strang. If the functions are not in the same main <script>...</script> block, those functions will not work. But the functions are in the same <script>...</script> block work fine (like below code). Any idea about it?

//////////////////// this page is true html page.
<script language='javascript'>
function A() {} // not work, if it ie copied to below block, it will work
function B() {} // not work, if it ie copied to below block, it will work
</script>

<script language='javascript'>
function C() {} // work
function C() {} // work

... //render html page part that will use the function

</script>
mayafree 2003-08-25
  • 打赏
  • 举报
回复
1、
<%
String value;
value = request.getParameter("txtUsername");
%>
2、1)去掉你的缓存试一下。
  2)写从你程序的根目录到指定文件的相对路径(非带盘符的绝对路径).
MyPlanet 2003-08-25
  • 打赏
  • 举报
回复
up
MyPlanet 2003-08-24
  • 打赏
  • 举报
回复
Is it possoble to use request("txtUsername") in HTML page? Why it give "Onject expected" error.
MyPlanet 2003-08-24
  • 打赏
  • 举报
回复
MyPage\about\about.html
MyPage\includes\toolbag.js

I include toolbag.js like below line in about.html.
<script language="javascript" src="../includes/toolbag.js"></script>


/////////////////// toolbag.js ////////////////
<!--

function QueryString(sName)
{
var sSource = String(window.document.location);
var sReturn = "";
var sQUS = "?";
var sAMP = "&";
var sEQ = "=";
var iPos;

iPos = sSource.indexOf(sQUS);

var strQuery = sSource.substr(iPos, sSource.length - iPos);
var strLCQuery = strQuery.toLowerCase();
var strLCName = sName.toLowerCase();

iPos = strLCQuery.indexOf(sQUS + strLCName + sEQ);
if (iPos == -1)
{
iPos = strLCQuery.indexOf(sAMP + strLCName + sEQ);
if (iPos == -1) return "";
}

sReturn = strQuery.substr(iPos + sName.length + 2,
strQuery.length - (iPos + sName.length + 2));
var iPosAMP = sReturn.indexOf(sAMP);

if (iPosAMP == -1) return sReturn;
else
{
sReturn = sReturn.substr(0, iPosAMP);
}

return sReturn;
}

-->
lyjlee 2003-08-24
  • 打赏
  • 举报
回复
1.如果在客户端用js只需
<script>
var txtusername;
txtusername=document.frmFirst.txtUsername.value;
alert(txtusername);
</script>
如果在服务端则只需用request("txtUsername")即可

2.贴代码,给你看看

61,111

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧