473,379 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

parse query string in href function?

77
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.com/index.php?showforum=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 2929
hsriat
1,654 Expert 1GB
Try this:
... &t='+tid+', ...
Mar 22 '08 #2
Inny
77
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 Expert 1GB
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
It still gives 'page not found' I dont get it! :(
Mar 23 '08 #5
Inny
77
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 Expert 1GB
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
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 Expert 1GB
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
Thanks Mate, but I dont have access to the php.
Mar 24 '08 #10
hsriat
1,654 Expert 1GB
Thanks Mate, but I dont have access to the php.
Then how to you get the value of tid?
Mar 25 '08 #11
Inny
77
Thats My Question Exactly, Its only apparent In the status bar When you mouseover the link.

Must be in the php.? When I use the Above in the browser address bar, the window pops up but the main page goes blank with [object] . Thats it.
Apr 3 '08 #12
hsriat
1,654 Expert 1GB
Dude, you know its sometimes already difficult to interpret problems.
And since you have replied after weeks, it has become more difficult. I have forgotten what I was guiding you to do.

Post your full code, not snippets so that I can look into it and then tell you what's wrong.


Regards,
Harpreet
Apr 3 '08 #13

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

Similar topics

3
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...
4
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...
3
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...
8
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) {...
3
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...
3
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...
6
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...
5
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
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.