Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 23-07-2009
Member
 
Join Date: Sep 2005
Posts: 82
javascript add parameter to url

I have a site which runs on a server side language PHP. It obviously uses URL to pass parameters here and there. What I wanted to know was I would like to change it to anything without having to go through the javascript search box. So can anyone tell me how to add parameter to url Javascript? Thank you
Reply With Quote
  #2  
Old 23-07-2009
Member
 
Join Date: Jun 2006
Posts: 620
Re: javascript add parameter to url

I cannot see the actualLink defined. and your alert should be lowercase
I think you need something this:
Code:
function jsInputBox(linky)  {
  var tlink=prompt("Enter a title for this search","");
  if(tlink=="") {
    alert("No Input Received");
  }
  else {
    var actualLink = linky.href;
    location = actualLink+"&title="+escape(tlink);
  }
  return false;
}
 
<a onclick="return jsInputBox(this)" href="<%=response.encodeURL("/createPDF.do?type="+status+"&start=0")%>" >Create Link</a>
Reply With Quote
  #3  
Old 23-07-2009
Member
 
Join Date: Dec 2007
Posts: 1,592
Re: javascript add parameter to url

If you want to add javascript parameter to string (URL) then try try{parent.MainFrame.location.href=...
Also alert in the catch to see what error ...jsRootId);} catch (e) {alert("Js Error: "+e);}"
Reply With Quote
  #4  
Old 23-07-2009
Member
 
Join Date: Dec 2007
Posts: 1,542
Re: javascript add parameter to url

You can also try this code:

Code:
<script type="text/javascript">
function extendSearch(addon) {
  window.location.search += addon;
}
</script>
...
<a href="#" onclick="extendSearch('&page=2');return false">
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "javascript add parameter to url"
Thread Thread Starter Forum Replies Last Post
JSF example url? Parameter Help!! Gadin Software Development 5 21-09-2010 10:05 PM
How to give a C# parameter a default value? Migueel Software Development 4 10-02-2010 10:21 PM
What is parameter tampering ? Anathakrishnan Technology & Internet 5 21-04-2009 09:25 AM
Parameter is incorrect Packham Media Player 3 09-12-2008 08:37 PM
QueryString parameter OnAfterLogin PEI Ramsey Software Development 5 04-11-2008 06:31 PM


All times are GMT +5.5. The time now is 12:58 PM.