English 中文(简体)
内部HTML 替代或以 div 取代换代事件
原标题:innerHTML alternative or replace onchange event with a div

我被一个问题缠住了 我需要你们帮助我

我有一个 html 表格。 它会将国家、 州、 城市和 pin 代码( 将手动输入) 发送到 php 文件, 以便使用 ajax 帮助处理 。 一旦提交后, 它会返回文本框中的 Pin 代码值 。

我想要的是,每当一个用户第二次改变针码值时, 表格需要重置。

我所做的是,我用 内部HTML像这样:

<form id="someid" method="post">
<input type="text" value=" .$_POST[ pin-code ]. " onChange="resetpin();" />

重置窗体像这样 :

function resetpin() {
document.getElementById( someid ).innerHTML = Full HTML CODE FROM ABOVE FORM GOES HERE

此代码变得丑陋, 因为. innerHTML 包含所有选择国家、 城市、 州的代码, 在同一页重复两次 。

所以,我所想的是什么, 我能做这样的事吗?

当用户第二次更改针时, 窗体需要重新设置 。

onchange=showdiv("ID of the form and contents to be displayed")

我可以做到这一点 这样我不需要使用内部HTML...

帮帮我吧

问题回答

您的 resetpin 函数需要通过窗体中重设其值的输入元素循环( 指针除外 ) 。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签