• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

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 = "";
     ...
     }

}
0
evibesmusic
Asked:
evibesmusic
  • 4
  • 2
  • 2
3 Solutions
 
for_yanCommented:
0
 
for_yanCommented:
I think something like that:
if(window.top.location.href.toLowerCase().indexOf('index.php?cmd=account&result=success') != -1) {

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

} 

Open in new window

0
 
for_yanCommented:
By the way, this question is  about JavaScript;
it should not be posted to "Java Programming Language" zone
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MacAnthonyCommented:
I prefer the regex approach, but either should work.

if(/index.php\?cmd=account&result=success/i.test(window.top.location.href)) {

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

}

Open in new window

0
 
MacAnthonyCommented:
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

0
 
evibesmusicAuthor Commented:
@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!
0
 
for_yanCommented:
You are always welcome.

0
 
evibesmusicAuthor Commented:
Cheers!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now