Log in

View Full Version : Adding a Querystring



SMDSports
05-01-2007, 02:34 PM
I know nothing about JS. Absolutely nothing.

soooo..with that said, I need to add a varible from my url into the following

linkset[0]='<a href="../admin/blahblah.cfm?job=front&type=database&sub=none">blahblah</a>'

I need to add the variable #url.sport#. Can it be done?

:confused:

jscheuer1
05-01-2007, 03:01 PM
Well, you could just write it in:

../admin/blahblah.cfm?job=front&type=database&sub=none&#url.sport#

But, is this truly a query? You already have a query:

?job=front&type=database&sub=none

The #url.sport# part looks like a hash - the sort of thing that is used with a named anchor to get the page to scroll to a specific spot when loading. Is that what it is? If so:

../admin/blahblah.cfm?job=front&type=database&sub=none#url.sport#

If it truly is a part of the query though, the # characters may need to be escaped:

../admin/blahblah.cfm?job=front&type=database&sub=none&%23url.sport%23

Or, do you mean that you want #url.sport# to operate as a server-side data retrieval token and be resolved before the link gets clicked?

SMDSports
05-01-2007, 03:39 PM
Well, its not an anchor...

its a variable passed from page to page so the db knows which information to pull.

in cf I would simply do the url and add &sport=#url.sport# and enclose it in output tags.

But becase the code in question is part of a JS mouse over link it doesn't quite work that way. It only outputs the exact text typed, that is #url.sport#.

jscheuer1
05-01-2007, 04:28 PM
If resolving #url.sport# requires that the page have - say, a .php extension, make sure your page has that extension. If the script is external, it needs that extension too.


&sport=#url.sport# and enclose it in output tags.

What's that look like?

You should be able to do the same, but the output tag syntax may need to be treated a certain way so as not to confuse the javascript parser.

Give me an example and I'll see if I can escape it for you.

However, if the #url.sport# value changes after the page has loaded and before the link is clicked, this change will not be reflected in the link.

SMDSports
05-01-2007, 04:48 PM
John

Thank you for your offer. I have decided to skip it. I have bigger fish to fry right now and making it pretty can be put on the back burner. If I decide to revisit this, I will let you know.


Thanks Again
Sharon
www.smdsports.com
:cool: