Copy link to clipboard
Copied
Actually I am trying to search whether a particular word exists in URL and trying with below code in in a .cfm file.
It works fine in html page but not working in coldfusion.Can someone help me how to resolve this issue
<script type="text/javascript">
var location = window.location.href;
if (location .indexOf("search_Text") > -1)
{
//do stuff
}
else
{
//do stuff
}
</script>
From what I gather this is not a ColdFusion question so I'm not sure why you have two result for coldfusion vs. html. Two things:
this.settings.self=document.location;
...
if(this.settings.self.href && (typeof this.settings.self.href==='
...Copy link to clipboard
Copied
Why is it not working? Are you getting an error? What happens?, what are you expecting to happen?
This is not CFML and wont be be Coldfusion giving you problem with this unless you haven't configured your server correctly.
Copy link to clipboard
Copied
Let me explain my problem in details.
Let as consider I am having a url http://ip/123/index.cfm?module=controller.list#Tab
In a screen I have four tab..If I click on 1st tab the url will be http://ip/123/index.cfm?module=controller.list#Tab_1
same way If I click on 2nd tab the url will be http://ip/123/index.cfm?module=controller.list#Tab_2
now through javascript I want to check if Tab_1 in url need to do stuff A\
if in url the value is Tab_2 then need to do stuff B..
Please help me how to carryout this functionality
Copy link to clipboard
Copied
I am not getting any error when I am running above code.
<script type="text/javascript">
var location = window.location.href;
if (location .indexOf("Tab_1") > -1)
{
//do stuff A
}
else
{
//do stuff B
}
</script>
But in all scenario stuff 2 is executing..
Copy link to clipboard
Copied
I would recommend asking this over at http://stackoverflow.com/
This is not a Coldfusion issue but a simple javascript knowledge / documentation issue.
Copy link to clipboard
Copied
From what I gather this is not a ColdFusion question so I'm not sure why you have two result for coldfusion vs. html. Two things:
this.settings.self=document.location;
...
if(this.settings.self.href && (typeof this.settings.self.href==='string')) {
// set to string property (IE fix)
this.settings.self = this.settings.self.href;
}
(the above was a snippet from a plug-in I wrote -- "this.settings" should be adjusted to your needs)
Hope one or both these help.