Link to home
Start Free TrialLog in
Avatar of evibesmusic
evibesmusicFlag for United States of America

asked on

How to evalute address bar location and return a specified result?

Experts,

How can I alter this java script to evaluate the address bar location, then produce a desired result?

Current Statement:

function at_attach(parent, child, showtype, position, cursor){
...
c.style.visibility = "hidden";
...
}

Desired Statement/Functionality - syntax is wrong of course:

if Current URL= 'index.php?cmd=account&result=success' {

     function at_attach(parent, child, showtype, position, cursor){
     ...
     c.style.visibility = "";
     ...
     }

}
SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By the way, this question is  about JavaScript;
it should not be posted to "Java Programming Language" zone
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
After rereading, you may want to put the test inside the function declaration instead of around it:

function at_attach(parent, child, showtype, position, cursor){

     if(/index.php\?cmd=account&result=success/i.test(window.top.location.href)) {
     ...
     c.style.visibility = "";
     ...
     }

}

Open in new window

Avatar of evibesmusic

ASKER

@for_yan:

Thank you. The solution worked perfectly and the first time.

I will ask the moderator to move the question to the Java Programming Language zone.

Cheers!
You are always welcome.

Cheers!