Results 1 to 4 of 4

Thread: javascript add parameter to url

  1. #1
    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

  2. #2
    Join Date
    Jun 2006
    Posts
    623

    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>

  3. #3
    Join Date
    Dec 2007
    Posts
    1,599

    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);}"

  4. #4
    Join Date
    Dec 2007
    Posts
    1,547

    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">

Similar Threads

  1. JSF example url? Parameter Help!!
    By Gadin in forum Software Development
    Replies: 5
    Last Post: 21-09-2010, 10:05 PM
  2. How to give a C# parameter a default value?
    By Migueel in forum Software Development
    Replies: 4
    Last Post: 10-02-2010, 10:21 PM
  3. What is parameter tampering ?
    By Anathakrishnan in forum Technology & Internet
    Replies: 5
    Last Post: 21-04-2009, 09:25 AM
  4. Parameter is incorrect
    By Packham in forum Media Player
    Replies: 3
    Last Post: 09-12-2008, 08:37 PM
  5. QueryString parameter OnAfterLogin PEI
    By Ramsey in forum Software Development
    Replies: 5
    Last Post: 04-11-2008, 06:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,643,712.41016 seconds with 17 queries