Jump to content

Using java Script in(Body onload)


ashii

Recommended Posts

I juz wana check if the Element value == 'user1' to gimme an alert rediderect to anthr page in the 'body onload 'itself which use to be lykdiz

 

function verify()
{
if(document.getElementById('txtcheck').value == 'user1')

alert("Your Password Has Been Expired Please change your password");
window.location.href="example.htm";

}

 

onload event

 

<body onLoad="verify();>

this works perfectly .. but ma probz is.....

 

if the element value is not == 'user1' then it doesnt give me an alert ... but it straightly redirect to the 'example.htm' page

but

if the page element value is not equal ... it should be in the same page without redirecting ...

 

can u plz help me in this case ???:answerpls::answerpls:

Link to comment
Share on other sites

maybe if you wrote like a normal human being I'd be able to answer your question.

:D :D :D :D :D

Yeah Il Try

i have two different php files .......

 

file no:1 where i get the user input to the element (TextBox) so the moment i click the submit button ....

I assign the value of the textbox to a session, continuesly it calls the other PHP file .... in the 2nd PHP file i am having a texbox which has the value of the same session...

 

eg: say that i type ashii in PHP file no1 and submit it.....

ashii will be assign to a session, and it will redirect the othe PHP file wich has a text box consisting the value of the session (ashii)

 

hope am normal nw???  :D

 

K.. nw i come to ma qstion...........

when ma 2nd php file loads ....... it will have the session value in the text box ....

so if the value of the text box is equal to 'user1' it should give me an alert sayin that "your Welcome". also it should redirect to anthr file/page.....

 

it works perfectly by using ma Script wich i posted previously......

but ma problem is ...

it does the same thing when the textbox value is not 'user1'...

(it rdeirects to the page without the alert)

 

did u u get me that what i am referring to????

 

 

Link to comment
Share on other sites

You need to learn to use proper English grammar.

 

But here's the fix.

function verify() {
if(document.getElementById('txtcheck').value == 'user1') {
   alert("Your Password Has Been Expired Please change your password");
   window.location.href="example.htm";
}    
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.