use javascript from code behind...??

I

ismaili.amin

Hi freinds,

How to execute a _javascript forcefully. Meaning, I dont want to set an
attribute for that. Till not what I am doing is like this,

On page load...

button.attributes.add("onclick","_javascript which loads another page
in parent")

and there is a requireed field validator on a text box.

Now what happens is like this...

It gives error for required field validator, if the entry is not made
in the text box, but, it also reloads the page given in the
_javascript. Ideally what should happen is, if the validation is OK,
then only it should reload to other page.

I dont want to use _javascript code for validation. So please tell me
how to do that..

THANKS IN ADVANCE
 
T

Thomas 'PointedEars' Lahn

How to execute a _javascript forcefully.

Is that a question?
Meaning, I dont want to set an attribute for that. Till not what I am
doing is like this,

On page load...

button.attributes.add("onclick","_javascript which loads another page
in parent")

Assuming that `button' is a reference to a button control object, it is
unlikely that it has an `attributes' property. It is more likely that
it has an `addEventListener' method (DOM Level 1+) --

function foo()
{
// _javascript which loads another page in parent
}

button.addEventListener("click", foo, false);

-- and even more likely that it has an `onclick' property (DOM Level 0):

button.onclick = foo;
and there is a requireed field validator on a text box.
Pardon?

Now what happens is like this...

It gives error for required field validator,

Probably it just yields a ReferenceError as the object does not have an
`attributes' property.
if the entry is not made
in the text box, but, it also reloads the page given in the
_javascript. Ideally what should happen is, if the validation is OK,
then only it should reload to other page.

Maybe you are just looking for proper form validation. If yes, ask Google,
we discussed this many times.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top