School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,579 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,227 people online right now. Registration is fast and FREE... Join Now!




Problem using variables

 

Problem using variables, Should be simple!

RichardDrew

1 Jul, 2009 - 06:14 AM
Post #1

New D.I.C Head
*

Joined: 1 Jul, 2009
Posts: 3

Here's the code....

CODE

html += "<a href=";
html += "java script:dmxAdvLayerPopup(\'ClubDetails\',\'/Report_ShowInfoClubs_Public.cfm?ourkey="
html += Club
html += "\',\'ClDet\',\'\',\'OS_Look\',\'center\',\'center\',850,650,0,true,false,false,80,\'\',\'\',0,false,\'\',\'\',0,false,\'\',1,5,true,false,\'#FFFFFF\')>View Club Details";
html += "</a>";


I use this code all over the place with no problems, usually I insert the variables in ColdFusion, but I inherited a page that uses javascript to parse a text file and pull the variables. The variable is Club, and it's four digits.

The above code should yield a link with a single long line, the four digits in the middle. If I just type in, say, 5555 instead of Club, it works fine. If I display Club alone, it shows a value. I have tried every combination I can think of, from arrays to replace - nothing works. The result is that only the first half of the URL is created.

The Club and the rest of the URL don't show up.

What I wind up with is:

java script:dmxAdvLayerPopup('ClubDetails','/Report_ShowInfoClubs_Public.cfm?ourkey=

Nothing after the = sign shows up!

it should look like

java script:dmxAdvLayerPopup('ClubDetails','/Report_ShowInfoClubs_Public.cfm?ourkey=5555','ClDet','','OS_Look','center','center',600,400,0,true,false,false,80,'','',0,false,'','',0,false,'',1,5,true,false,'#FFFFFF')

Any ideas?

Thanks

User is offlineProfile CardPM
+Quote Post


Martyr2

RE: Problem Using Variables

1 Jul, 2009 - 05:38 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 7,246



Thanked: 820 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Remove the space between "java" and "script" and make it all one word "javascript". Then give it another go and see if that fixes the problem. Make sure that Club is also set properly to the value you want to appear in the link.

smile.gif
User is offlineProfile CardPM
+Quote Post

RichardDrew

RE: Problem Using Variables

1 Jul, 2009 - 08:37 PM
Post #3

New D.I.C Head
*

Joined: 1 Jul, 2009
Posts: 3

The "java script" was a cut and past problem - it actually is
CODE
<a href=java script:dmxAdvLayerPopup('ClubDetails','/Report_ShowInfoClubs_Public.cfm?ourkey=xxxx','ClDet','','OS_Look','center','center',600,400,0,true,false,false,80,'','',0,false,'','',0,false,'',1,5,true,false,'#FFFFFF')>View Club Details</a>

What I am trying to do is replace the "xxxx" with the variable "Club" so I broke the line into parts.

The variable "Club" does have a value.

It has to be a security thing here - I jave typed out javascript as one word, but the save command breaks it into two words. Even in code form.

Thanks

Rick

This post has been edited by RichardDrew: 2 Jul, 2009 - 12:52 AM
User is offlineProfile CardPM
+Quote Post

roudard

RE: Problem Using Variables

2 Jul, 2009 - 05:45 AM
Post #4

D.I.C Head
**

Joined: 26 Sep, 2005
Posts: 139



Thanked: 16 times
My Contributions
Hi,

CODE
<a href="java script:dmxAdvLayerPopup('ClubDetails','/Report_ShowInfoClubs_Public.cfm?ourkey='+Club,'ClDet','','OS_Look','center','center',600,400,0,true,false,false,80,'','',0,false,'','',0,false,'',1,5,true,false,'#FFFFFF')">View Club Details</a>

should do .. assuming you have assigned a value to the Club variable in the correct scope. to make sure just alert it first :

CODE
<a href="java script:alert(Club);dmxAdvLayerPopup('ClubDetails','/Report_ShowInfoClubs_Public.cfm?ourkey='+Club,'ClDet','','OS_Look','center','center',600,400,0,true,false,false,80,'','',0,false,'','',0,false,'',1,5,true,false,'#FFFFFF')">View Club Details</a>


hope this helps


QUOTE(RichardDrew @ 1 Jul, 2009 - 08:37 PM) *

The "java script" was a cut and past problem - it actually is
CODE
<a href=java script:dmxAdvLayerPopup('ClubDetails','/Report_ShowInfoClubs_Public.cfm?ourkey=xxxx','ClDet','','OS_Look','center','center',600,400,0,true,false,false,80,'','',0,false,'','',0,false,'',1,5,true,false,'#FFFFFF')>View Club Details</a>

What I am trying to do is replace the "xxxx" with the variable "Club" so I broke the line into parts.

The variable "Club" does have a value.

It has to be a security thing here - I jave typed out javascript as one word, but the save command breaks it into two words. Even in code form.

Thanks

Rick


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 08:21AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month