473,804 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parse query string in href function?

77 New Member
Im trying to rewrite a link with a href function. I need to parse a query string within it ('+tid')

But all attempts Have falied. The current onclick/ link function

Expand|Select|Wrap|Line Numbers
  1. <a href="java script:who_posted();">Who Posted?</a>
  2.  
is attached to my forums 'replys' number colum in forum veiw' {i have no direct access}

it appears in the staus bar on hover as

Expand|Select|Wrap|Line Numbers
  1. <a href="java script:who_posted(428);">Who Posted?</a>
where '428 is the tid (topic id).

I want to write a href link to do this (elsewhere in html) and add the tid of whatever topic
the page is currently on.

see site for clarification (click the 'replies' number next to a title)

http://inny.ipbfree.co m/index.php?showf orum=1

click on any topic, and see a mail href link above. I want to add the who_posted function href there, so that whatever topic your on, the who posted box will work.

code is {no direct access}
Expand|Select|Wrap|Line Numbers
  1. <script language='javascript' type="text/javascript">
  2. <!--
  3.     function who_posted(tid)
  4.     {
  5.         window.open("http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t="+tid, "WhoPosted", "toolbar=no,scrollbars=yes,resizable=yes,width=230,height=300");
  6.     }
  7. //-->
  8. </script>
  9.  
Im not sure to write the new link to include the extra function of adding the topic id (tid)

i tried a few variations on
Expand|Select|Wrap|Line Numbers
  1. <a href="java script:window.open("http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t="+tid, "WhoPosted", "toolbar=no,scrollbars=yes,resizable=yes,width=230,height=300");>Who Posted?</a>
  2.  
  3.  
and i thought it might be the quotes, i tried

Expand|Select|Wrap|Line Numbers
  1. <a href="java script:window.open('http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t='+tid, 'WhoPosted', 'toolbar=no,scrollbars=yes,resizable=yes,width=230,height=300')";>Who Posted?</a>

No joy

then i tried 2 functions

Expand|Select|Wrap|Line Numbers
  1. <a href="java script:who_posted(tid);window.open('http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t='+tid, 'WhoPosted', 'toolbar=no,scrollbars=yes,resizable=yes,width=230,height=300')";>Who Posted?</a>
  2.  
What am I doing wrong?
please assist?
Mar 22 '08 #1
12 2974
hsriat
1,654 Recognized Expert Top Contributor
Try this:
... &t='+tid+', ...
Mar 22 '08 #2
Inny
77 New Member
Ok I tried this but I got page not found

Expand|Select|Wrap|Line Numbers
  1. <a href="java script:window.open("http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t='+tid+', "WhoPosted", "toolbar=no,scrollbars=yes,resizable=yes,width=230,  height=300");>Who Posted?</a>
Mar 22 '08 #3
hsriat
1,654 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. <a href="java script:window.open('http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t='+tid+', WhoPosted', 'toolbar=no,scrollbars=yes,resizable=yes,width=230,  height=300');">Who Posted?</a>
Be careful while using quotes.
Mar 22 '08 #4
Inny
77 New Member
It still gives 'page not found' I dont get it! :(
Mar 23 '08 #5
Inny
77 New Member
There appears to be an extra function involved?

Expand|Select|Wrap|Line Numbers
  1. <script language='javascript'>
  2. <!--
  3.  function bog_off()
  4.  {
  5.      var tid = '1143';
  6.      var fid = '2';
  7.  
  8.      opener.location= 'http://inny.ipbfree.com/index.php?' + 'showtopic=' + tid;
  9.      self.close();
  10.  }
  11.  //-->
  12.  </script>
Mar 23 '08 #6
hsriat
1,654 Recognized Expert Top Contributor
Try this...
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:window.open('http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t='+tid, 'WhoPosted', 'toolbar=no,scrollbars=yes,resizable=yes,width=230,  height=300');">Who Posted?</a>
I made a good mistake in the earlier one, although I was telling you to use quotes carefully.

Harpreet
Mar 23 '08 #7
Inny
77 New Member
Unfortunately This is not working either. I just dont understand it, Think it needs to add 'fid' (forum id) aswell, see extra function i found above.
Mar 23 '08 #8
hsriat
1,654 Recognized Expert Top Contributor
Unfortunately This is not working either. I just dont understand it, Think it needs to add 'fid' (forum id) aswell, see extra function i found above.
I tried to do that on your website.
Altho I was scared from the snake out there, but what I suggested last time worked fine when I replaced tid with 1066. So I guess the value of tid is not being passed properly.
Type this in your address bar, press enter. It will work.
Expand|Select|Wrap|Line Numbers
  1. javascript:window.open("http://inny.ipbfree.com/index.php?s=&act=Stats&CODE=who&t=1066", "WhoPosted", "toolbar=no,scrollbars=yes,resizable=yes,width=230,  height=300");
Try to provide the tid to each link at server side by changing your PHP.
Mar 23 '08 #9
Inny
77 New Member
Thanks Mate, but I dont have access to the php.
Mar 24 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2313
by: Jesse | last post by:
I have a string with the following information. $myString = "This is my example string please. Please visit http://www.mylink.com . More example text goes here. another link http://www.link2.com . more text.. blah.."; What I'm wanting is a function to return the following string : $myString = This is my example string please. Please visit <a href'http://www.mylink.com'>link</a> . More example text goes here.
4
8822
by: Mark Anderson | last post by:
Sorry if this is a rookie mistake... I've been through all the FAQs and the books I have but I can't see the mistake so I guess it's something simple <g> - I'm an occasional JS user. I've got some code (in an external JS file) attached to a number of links off a query result page. The code it checks if there are any ticked items on the page and adds them to a lightbox (cart) before going the next called result page. The idea is to stop...
3
4923
by: Dennis M. Marks | last post by:
I am looking for a javascript function that will parse a query string. Parameters are passed in the url: url?a=3&c=5&etc An array is returned that uses the variable name as the index. array=3 array=5 etc. -- Dennis M. Marks http://www.dcs-chico.com/~denmarks/
8
8248
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) { document.location.href = document.location.href.substring(0, document.location.href.indexOf('#')) + '?' + newUrl; } else { document.location.href = document.location.href + '?' + newUrl; }
3
7452
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script "text/javascript"> function getQueryVariable(variable) { var query = window.location.search.substring(1);
3
4747
by: Ken Bush | last post by:
How can I write an update query that removes part of a field? Like if I have a field with values such as 8/3/68 (a birthday obviously) and I need to put values in a new column but I need everything after and including the final / removed to end up with simply 8/3
6
2200
by: Ian Davies | last post by:
Hello I have found the following script php/java for dynamic menu lists. Where a selection from the first updates (filters items in) the other. I have modified it for my tables. However I am getting an error Parse error: parse error, unexpected T_VAR in e:\domains\i\iddsoftware.co.uk\user\htdocs\QuestionDB\Questions.php on line 42
5
1476
by: Dennis | last post by:
I'm sure there is an easy way to do what I want but I'm failing to find it... I have a single web page with links back to itself with set query strings... href="?data=x" href="?data=y"
1
1967
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on the page are used to call itself with querystring values for brand, thinner, finish, etc. The page must show all colors if the querystring is empty and filter out records that don't match the querystring value when it's not. I've tried building...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.