弹出动态文本框和查询字符串的窗口问题 [英] Pop up window problem with dynamic textboxes and query string

查看:57
本文介绍了弹出动态文本框和查询字符串的窗口问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

我需要实现的是:

我通过dhtml编码生成动态文本框,我需要onChange

oragnistation文本框的事件,即点击

" More" myhtml页面中的按钮

系列方式如oragnisation0,oragnisation1,oragnisation2等

on,

和弹出窗口将打开onChange事件( oraganisation< iCount>)

,带有一个查询字符串/参数,即oraganisation的值,这样我将使用该参数作为在pop窗口形式中搜索crieterion,并且

将显示与该值对应的数据。进一步的用户可以在弹出窗口中显示的任何值上点击

最后弹出窗口中的所有值

窗口现在将设置为父类形式,如组织名称,区域,城市

等基本上我需要搜索表单将在弹出窗口中打开1

参数并相应显示记录。我在

静态表格和静态文本框onChange事件中获得了这个东西,但当我把

onChange时,即使用 ?id ="在下面的代码中

onChange =''javascript :openWin(contact_list.php" +(str)+ iCount +" .value)''

其中(str)=?id =


var strTemp =" id = organization" ;;

str ="?" + strTemp;


我将收到预期的错误":在行号....

所以我只想要以某种方式我将能够以

查询字符串打开弹出窗口作为

openWin(contact_list.php?id = organization<(iCount)> .value)


如果我删除?错误将不会出现?来自代码。


提前感谢您的帮助

以下是我收到错误的实际代码:

< script>

var strTemp =" id = organization";

str ="?" + strTemp;


cust1.innerHTML + ="< table width = 100%border = 0 cellpadding = 0

cellspacing = 0>< tr> ;< td>< table width = 100%border = 0 cellspacing = 0

cellpadding = 4>< tr>< td width = 10%>< strong> Title< / strong>< / td>< td

width = 11%>< strong>名字< / strong>< / td>< td width = 11%>< ; strong>最后

名称< / strong>< / td>< td width = 14%>< strong>名称< / strong>< / td>< td

width = 20%>< strong>组织< / strong>< / td>< td width = 20%

Dear All,
What i need to achieve is :
I am generating dynamic text boxes thru dhtml coding, i need onChange
event of oragnistation text box i.e dynamically generated on click of
"More" button in myhtml page
in series manner like oragnisation0,oragnisation1,oragnisation2 and so
on,
and popup window will open onChange event of (oraganisation<iCount>)
with one query string / parameter i.e value of oraganisation so that i
will use that parameter as searching crieterion in pop window form, and
that will show data corresponding to that value. Further user can click
on any value displayed in popup windows finally all values in popup
window will now set in parent form like oraganisation name, area, city
etc so basically i need search form will open in pop up window with 1
paramater and display record accordingly. I have achived this thing in
static form and static textbox onChange event, but when i put the
onChange even with " ?id= " in below code as
onChange=''javascript: openWin(contact_list.php"+(str)+iCount+".value)''
where (str) = ?id=

var strTemp = "id=organisation";
str = "?" + strTemp;

i will get an error expected ":" on line number....
So i only want that somehow i''ll be able to open popup window with
querystring as
openWin(contact_list.php?id=organisation<(iCount)> .value)

The error will not come if i''ll remove "?" from the code.

Thanks for Help in advance
Below is actual code in which I''m getting error :
<script>
var strTemp = "id=organisation";
str = "?" + strTemp;

cust1.innerHTML +="<table width=100% border=0 cellpadding=0
cellspacing=0><tr><td><table width=100% border=0 cellspacing=0
cellpadding=4><tr><td width=10%><strong>Title</strong></td><td
width=11%><strong>First Name </strong></td><td width=11%><strong>Last
Name </strong></td><td width=14%><strong>Designation</strong></td><td
width=20% ><strong>Organisation</strong></td><td width=20%

< strong> Area< / strong> ;< / td>< td width = 41%class = name>& nbsp;< / td>< / tr>< tr>< td>< label>< select name = title" + ICOUNT + QUOT; ID =标题" + iCount +">< option value = Mr。 selected = selected> Mr.< / option>< option value = Ms.> Ms.< / option>< / select>< / label>< / td>< td><输入名称= first_name的" + iCount +" type = text id = first_name" + iCount +" size = 10 />< / td>< td>< input name = last_name" + iCount +" type = text id = last_name" + iCount +" size = 10 />< / td>< td>< input name = designation" + iCount +" type = text id = name" + iCount +" size = 15 />< / td>< td>< input name = organization" + iCount +" type = text id = organization" + iCount +" size = 15 onChange =''javascript :openWin(contact_list.php" +(str)+ iCount +" .value)''/>< / td>< td><输入名称=区域 + iCount +" type = text id = area" + iCount +"大小= 15 />< / TD>< TD>&安培; NBSP;< / TD>< / TR>< /表>< / TD>< / TR>< TR>< td>< table width = 100%border = 0 cellspacing = 0 cellpadding = 4>< tr>< td width = 90>< strong> City< / strong>< / td>< td width = 90> ;< strong>移动< / strong>< / td>< td width = 91>< strong>固定电话< / strong>< / td>< td width = 91>< strong>电子邮件< / strong>< / td>< td>< strong>对PT有用吗?< / strong>< / td>< td>< strong>评分< / strong>< / td>< / tr>< tr>< td>< span class = name>< input name = city" + ICOUNT + QUOT; type = text id = city" + ICOUNT + QUOT; value =''''size = 15 />< / span>< / td>< td>< span class = name>< input name = mobile" + ICOUNT + QUOT; type = text id = mobile" + ICOUNT + QUOT; value =''''size = 15 />< / span>< / td>< td>< span class = name>< input name = landline" + ICOUNT + QUOT; type = text id = landline" + ICOUNT + QUOT; value =''''size = 15 />< / td>< td>< span class = name>< input name = email" + ICOUNT + QUOT; type = text id = email" + ICOUNT + QUOT; value =''''onblur =''javascript :return echeck(document.frm.email" + iCount +" .value)''size = 15 />< / span>< ; / td>< td>< label>< select name = helpful" + ICOUNT + QUOT; ID =有用" + iCount +"><选项值=是>是< /选项><选项值=否>否< /选项>< / select>< / label>< / td>< td> < select name = rating" + ICOUNT + QUOT; ID =评级" + iCount +">< option value = 1> 1< / option>< option value = 2> 2< / option>< option value = 3> 3< / option>< option value = 4> 4< / option>< option value = 5> 5< / option>< option value = 6> 6< / option>< option value = 7> 7< / option>< option value = 8> 8< / option>< option value = 9> 9< / option>< option value = 10> 10< / option>< / select>< / td>< / tr>< tr>< td colspan = 6>< hr />< / td>< / tr>< tr>< td colspan = 6>< / td>< / tr>< / table>< / td> < / tr>< / table>" ;;
<strong>Area</strong></td><td width=41% class=name>&nbsp;</td></tr><tr><td><label><select name=title" +iCount+" id=title" +iCount+ "><option value=Mr. selected=selected>Mr.</option><option value=Ms.>Ms.</option></select></label></td><td><input name=first_name" +iCount+ " type=text id=first_name" +iCount+ " size=10/></td><td><input name=last_name" +iCount+ " type=text id=last_name" +iCount+ " size=10/></td><td><input name=designation" +iCount+ " type=text id=designation" +iCount+ " size=15/></td><td><input name=organisation" +iCount+ " type=text id=organisation" +iCount+ " size=15 onChange=''javascript: openWin(contact_list.php"+(str)+iCount+".value)''/></td><td><input name=area" +iCount+ " type=text id=area" +iCount+ " size=15/></td><td>&nbsp;</td></tr></table></td></tr><tr><td><table width=100% border=0 cellspacing=0 cellpadding=4><tr><td width=90><strong>City</strong></td><td width=90><strong>Mobile</strong></td><td width=91><strong>Landline</strong></td><td width=91><strong>Email</strong></td><td><strong>Helpful to PT ?</strong></td><td><strong>Rating</strong></td></tr><tr><td><span class=name><input name=city" +iCount+" type=text id=city" +iCount+" value='''' size=15/></span></td><td><span class=name><input name=mobile" +iCount+" type=text id=mobile" +iCount+" value='''' size=15 /></span></td><td><span class=name><input name=landline" +iCount+" type=text id=landline" +iCount+" value='''' size=15/></td><td><span class=name><input name=email" +iCount+" type=text id=email" +iCount+" value='''' onblur=''javascript:return echeck(document.frm.email" +iCount+".value)'' size=15/></span></td><td><label><select name=helpful" +iCount+" id=helpful" +iCount+"><option value=Yes>Yes</option><option value=No>No</option></select></label></td><td><select name=rating" +iCount+" id=rating" +iCount+"><option value=1>1</option><option value=2>2</option><option value=3>3</option><option value=4>4</option><option value=5>5</option><option value=6>6</option><option value=7>7</option><option value=8>8</option><option value=9>9</option><option value=10>10</option></select></td></tr><tr><td colspan=6><hr /></td></tr><tr><td colspan=6></td></tr></table></td></tr></table>";




< / script>



</script>

推荐答案

Kapil Jain写道:
Kapil Jain wrote:
[...]我已经以静态形式和静态文本框onChange
事件获得了这个东西,但是当我把onChange甚至用 ?id ="在下面的代码中
onChange =''javascript :openWin(contact_list.php" +(str)+ iCount +" .value)''
^ [1]

删除`javascript :'',然后声明默认脚本语言


< meta http-equiv ="内容脚本型" content =" text / javascript">

'head''元素中的



参见< URL:http: //jibbering.com/faq/#FAQ4_24>。

其中(str)=?id =

var strTemp =" id = organization";
str ="?" + strTemp;

我将收到预期的错误":在行号....
所以我只想要以某种方式我能用
查询字符串打开弹出窗口作为
openWin(contact_list.php?id = organization<(iCount) )> .value)
^如果我将删除?错误将不会出现。从代码。


[^ 1]`contact_list.php''被视为属性访问(使用`contact_list''

作为基础对象,'php''为除非_enclose_

它在_both_双边用双引号括起来。以下双引号()是一个

语法错误,因为运算符随后丢失。无论如何,继续在

中解析你的优惠,脚本引擎在文字

之外遇到?并假设三元条件运算符(?:);这个运算符需要一个

`:''来区分第一个操作数的

false-case的表达式中的true-case的表达式。您没有提供它,因此显示语法

错误。但是,你看到之前发生了真正的错误。


你是正确的,如果你省略'?'',那么第二个错误就不会发生,

但最初的一个仍然存在。

提前感谢您的帮助


欢迎您,但下次请RTFFAQ和RTFM。

另请参阅


< URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>

< ;网址:http://www.safalra.com/special/googlegroupsreply/>


回复我的帖子。

以下是实际代码我收到错误:
< script>


应该是


< script type =" text / javascript">


见< URL:http://validator.w3.org/>。

var strTemp =" id = organization" ;;
str ="?" + strTemp;

cust1.innerHTML + ="< table width = 100%border = 0 cellpadding = 0
[1] ^^^^^^^^^ ^^ [ 2] ^^^^ [3]

[1]考虑使用W3C DOM方法来构建元素子树。


[2] ]应该避免使用此运算符进行字符串连接。


[3]包含例如的属性值'%''字符必须是

,用单引号('')或双引号引号括起来。最好将所有属性值包含在引号中。


< URL:http://www.w3.org/TR/html4/ intro / sgmltut.html#idx-attribute-6>

cellspacing = 0>< tr>< td>< table width = 100%border = 0 cellspacing = 0


ISTM您滥用表格进行布局,这种做法已被弃用了很久

自此。外表似乎没必要;省略它并使用CSS来代替
格式化(唯一真实的)内部表格的边框和边距。

cellpadding = 4>< tr>< td width = 10%>< strong>标题< / strong>< / td>< td
^^^^^^^^^^^^^^^^^^^^^^
您滥用强元素来实现粗体文本。这个元素

是将内容标记为_important_,以便可视用户代理可以通过显示它来强调它,例如
粗体或斜体,例如一个屏幕阅读器

应用程序可以在这些场合提高声音。使用'b''(b代表粗体)

元素代替,或者更好的是,省略'strong''元素的标签,

更改`td'' (表数据,它不是)进入'th''(表头,它是

)并使用CSS相应地格式化它(text-align:left;

font-weight:bold)。

[...]
[...] I have achived this thing in static form and static textbox onChange
event, but when i put the onChange even with " ?id= " in below code as
onChange=''javascript: openWin(contact_list.php"+(str)+iCount+".value)'' ^[1]
Remove the `javascript:'', then declare the default scripting language by

<meta http-equiv="Content-Script-Type" content="text/javascript">

in the `head'' element.

See also <URL:http://jibbering.com/faq/#FAQ4_24>.
where (str) = ?id=

var strTemp = "id=organisation";
str = "?" + strTemp;

i will get an error expected ":" on line number....
So i only want that somehow i''ll be able to open popup window with
querystring as
openWin(contact_list.php?id=organisation<(iCount)> .value) ^ The error will not come if i''ll remove "?" from the code.
[^1] `contact_list.php'' is considered a property access (with `contact_list''
as base object and `php'' as the name of its property) unless you _enclose_
it in double quotes on _both_ sides. The following double quote (") is a
syntax error because the operator is then missing. Continuing to parse in
your favor anyway, the script engine encounters a `?'' outside of a literal
and assumes the trinary conditional operator (?:); this operator requires a
`:'' to delimit the expression for the true-case from the expression for the
false-case of the first operand. You do not provide it, hence the syntax
error displayed. However, you see that the real error occurred before.

You are correct that the second error does not occur if you omit the `?'',
however the initial one remains.
Thanks for Help in advance
You are welcome, but please RTFFAQ and RTFM next time.

See also

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
<URL:http://www.safalra.com/special/googlegroupsreply/>

before you reply to my posting.
Below is actual code in which I''m getting error :
<script>
Should be

<script type="text/javascript">

See <URL:http://validator.w3.org/>.
var strTemp = "id=organisation";
str = "?" + strTemp;

cust1.innerHTML +="<table width=100% border=0 cellpadding=0 [1]^^^^^^^^^ ^^[2] ^^^^[3]

[1] Consider using W3C DOM methods to build the element subtree instead.

[2] This operator should be avoided for string concatenation.

[3] Attribute values containing e.g. the `%'' character must be
enclosed in single ('') or double (") quotes. It is best
to enclose all attribute values in quotes always.

<URL:http://www.w3.org/TR/html4/intro/sgmltut.html#idx-attribute-6>
cellspacing=0><tr><td><table width=100% border=0 cellspacing=0
ISTM that you are misusing tables for layout, a practice deprecated long
since. The outer table does not seem necessary; omit it and use CSS to
format the (borders and margins of the only real) inner table instead.
cellpadding=4><tr><td width=10%><strong>Title</strong></td><td ^^^^^^^^^^^^^^^^^^^^^^
You are misusing the `strong'' element for achieving bold text. This element
is to mark up content to be _important_, so that a visual user agent can
emphasize it by displaying it e.g. bold or italic and e.g. a screenreader
application can raise voice on these occasions. Use the `b'' (b for bold)
element instead or, even better, omit the tags for the `strong'' element,
change `td'' (table data, which it is not) into `th'' (table header, which it
is) and use CSS to format it accordingly (text-align:left;
font-weight:bold).
[...]
id = designation" + iCount +" size = 15 />< / td>< td>< input name = organization"
+ iCount +" type = text id = organization" + iCount +" size = 15
onChange =''javascript
openWin(contact_list.php" +(str)+ iCount +" .value)''/>< / td>< td>< input


对于您的用户而言,拥有

窗口或浏览器标签(!)绝对令人不安甚至困扰每当他们改变这个

输入控件的值时弹出。我强烈建议使用另一种方法,例如

a按钮,他们必须点击以实现相同的目标。

[...]
class = name> < input name = email" + ICOUNT + QUOT; type = text id = email" + iCount +"
value =''''onblur =''javascript :return echeck(document.frm.email"
[1] ^^^^^^^ ^^^^^ ^^^^^^ [2]

[1]同样在这里。


[2]如果要验证表单数据,当表格即将提交时,你最好这样做(在`onsubmit''事件处理程序属性值

'形'元素。

[...]< / td>< / tr>< / table>< / td>< / tr>< / table>" ;;
id=designation" +iCount+ " size=15/></td><td><input name=organisation"
+iCount+ " type=text id=organisation" +iCount+ " size=15
onChange=''javascript:
openWin(contact_list.php"+(str)+iCount+".value )''/></td><td><input
It is definitely unnerving for or even bothering to your users to have a
window or browser tab(!) pop up every time they change the value of this
input control. I strongly recommend using another approach, for example
a button they have to click in order to achieve the same.
[...]
class=name><input name=email" +iCount+" type=text id=email" +iCount+"
value='''' onblur=''javascript:return echeck(document.frm.email" [1]^^^^^^^^^^^ ^^^^^^[2]
[1] Same here.

[2] If you want to validate form data, you better do this when the form is
about to be submitted (in the `onsubmit'' event handler attribute value
of the `form'' element.
[...] </td></tr></table></td></tr></table>";



< / script>



</script>




'script''元素'的内容是HTML格式的CDATA(字符数据)。你有

来转义所有EndTAGOpen分隔符(ETAGO:"< /")。标记解析器可能会过早地考虑元素的内容,否则将会
/>
导致脚本引擎不完整,因此语法错误的脚本代码为

。例如,上面的行应该是


[...]< \ / td>< \ / tr>< \ / table>< \ / td>< \ / tr>< \ / table> ;" ;;


如果将脚本代码放在外部

脚本文件中并使用`script''元素''''''''''''''''''''''''''' s`src''属性来引用它。

这适用于所有HTML 4用户代理。

HTH


PointedEars


PS

你发布了相同的四(!)次。 NetNews不是实时的

通讯媒介,你必须等待你的文章出现。

使用< URL:http://services.google.com :8882 / urlconsole /控制器>

删除重复项。



The `script'' element''s content is CDATA (Character DATA) in HTML. You have
to escape all EndTAGOpen delimiters (ETAGO: "</"). The markup parser is
likely to consider the element''s content prematurely otherwise which will
result in incomplete and therefore syntactically incorrect script code for
the script engine. For example, the above line should be

[...] <\/td><\/tr><\/table><\/td><\/tr><\/table>";

You can workaround this issue if you place the script code in an external
script file and use the `script'' element''s `src'' attribute to refer to it.
This will work in all HTML 4 user agents.
HTH

PointedEars

P.S.
You have posted the same four(!) times. NetNews is not a real-time
communication medium, you have to wait for your articles to appear.
Use <URL:http://services.google.com:8882/urlconsole/controller> to
remove the duplicates.


Thomas''PointedEars''Lahn写道:
Thomas ''PointedEars'' Lahn wrote:
Kapil Jain写道:
Kapil Jain wrote:
[...]< / td>< / tr>< / table>< / td>< / tr>< / table>" ;;

< / script>
`script''元素'的内容是HTML格式的CDATA(字符数据)。您必须逃避所有EndTAGOpen分隔符(ETAGO:"< /")。标记解析器
可能过早地考虑元素的内容,否则
[...] </td></tr></table></td></tr></table>";

</script>
The `script'' element''s content is CDATA (Character DATA) in HTML. You
have to escape all EndTAGOpen delimiters (ETAGO: "</"). The markup parser
is likely to consider the element''s content prematurely otherwise



^^^^^^^^^^^^

_to end_

这会导致脚本引擎的语法代码不完整,因此语法不正确。 [...]


^^^^^^^^^^^^
_to end_ prematurely
which will result in incomplete and therefore syntactically incorrect
script code for the script engine. [...]



PointedEars


PointedEars


亲爱的先生,


谢谢很多让我理解复杂的问题,我真的没有听到过这个问题。


感谢您的帮助。


如果你给我正确的代码,我会很高兴,因为我做了

不明白我需要遵循的确切步骤我明白了一点

所以请帮助我这次也是。


问候,

Kapil。

Dear Sir,

Thanks a lot for making me understand complex issues which i really not
ever heard.

Thanks for great help.

I will be greatful if you give me correct piece of code because i did
not understand the exact steps which i need to follow i understand a
little so please help me this time also.

Regards,
Kapil.


这篇关于弹出动态文本框和查询字符串的窗口问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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