E
Erland
Hello All,
I've registered a handler on 's onclick and in this handler I try to
change the style of a textbox. More specifically, I try to change the
border of textbox to "solid black 1px" which is originally set to
"0px". Now part of the problem is that code in handler only occurs for
a 1/10th of a second, that is I see the textbox's border turning into
"solid black 1px" but that just happens for 1/10th of a second and
textbox's border again becomes "0px". I can't figure out why onclick
handler on happens for a flicker and why don't changes that I'm
making in this handler persist. Please pardon my ignorance, I'm just
learning DOM/DHTML and Javascript.
Here is my html
<div class="frame">
FirstName: <input type="text" value="Waqas" class="fname"></input><br>
Edit <!--This is my anchor tag, HTML viewing might skim it, it has a
class with name 'editt-->
<br>
</div>
here is my handler
function editHandler(event)
{
var e=event || window.event;
var node=this.parentNode;
if (node != null)
{
for (var i=node; node.nodeName != "INPUT" ; i
=node.previousSibling)
node=i;
node.focus();
node.value ="Hello there, after edit";
node.style.border="solid black 1px";
this.value='Save';
alert("everything is fine");
return true;
}
else
{
alert("Some error occured");
return false;
}
and here is the css included in my HTML head
function editHandler(event)
{
var e=event || window.event;
var node=this.parentNode;
if (node != null)
{
for (var i=node; node.nodeName != "INPUT" ; i
=node.previousSibling)
node=i;
node.focus();
node.value ="Hello there, after edit";
node.style.border="solid black 1px";
this.value='Save';
alert("everything is fine");
return true;
}
else
{
alert("Some error occured");
return false;
}
I will really appreciate any help
I've registered a handler on 's onclick and in this handler I try to
change the style of a textbox. More specifically, I try to change the
border of textbox to "solid black 1px" which is originally set to
"0px". Now part of the problem is that code in handler only occurs for
a 1/10th of a second, that is I see the textbox's border turning into
"solid black 1px" but that just happens for 1/10th of a second and
textbox's border again becomes "0px". I can't figure out why onclick
handler on happens for a flicker and why don't changes that I'm
making in this handler persist. Please pardon my ignorance, I'm just
learning DOM/DHTML and Javascript.
Here is my html
<div class="frame">
FirstName: <input type="text" value="Waqas" class="fname"></input><br>
Edit <!--This is my anchor tag, HTML viewing might skim it, it has a
class with name 'editt-->
<br>
</div>
here is my handler
function editHandler(event)
{
var e=event || window.event;
var node=this.parentNode;
if (node != null)
{
for (var i=node; node.nodeName != "INPUT" ; i
=node.previousSibling)
node=i;
node.focus();
node.value ="Hello there, after edit";
node.style.border="solid black 1px";
this.value='Save';
alert("everything is fine");
return true;
}
else
{
alert("Some error occured");
return false;
}
and here is the css included in my HTML head
function editHandler(event)
{
var e=event || window.event;
var node=this.parentNode;
if (node != null)
{
for (var i=node; node.nodeName != "INPUT" ; i
=node.previousSibling)
node=i;
node.focus();
node.value ="Hello there, after edit";
node.style.border="solid black 1px";
this.value='Save';
alert("everything is fine");
return true;
}
else
{
alert("Some error occured");
return false;
}
I will really appreciate any help