SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My memory simply eludes me lately. I'm running a javascript function that changes the value of a form field when the link is clicked on. Currently, I leave the 'href' attribute as "", and then set the onClick attribute to run the JavaScript function.

    only problem is, it goes back to the main page of my site.

    Any suggestions? I know this, but it must've been shoved out of the back of my head.

    Thanks again!
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  2. #2
    SitePoint Zealot
    Join Date
    Dec 1999
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should use href="#" or href="javascript:void(0)" to solve the problem.

  3. #3
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    As another solution, you could do:

    <a href="javascript:myFunction()">

    aDog

  4. #4
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Arielladog
    Hey,

    As another solution, you could do:

    <a href="javascript:myFunction()">

    aDog
    Thank you! I knew there was a solution somewhere, guys. I will use aDog's for now, as it is the one I remember.

    Also, thank you PGA! Yours is a solution as well.

    Thanks again!
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  5. #5
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, Guys...The link works well, but the function I'm doing isn't. All I want to do is change a form value to be an ASP value (don't worry about -- It's the HTTP_REFERRER part, I know it's right).

    anyway, here's the code:
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    function doRefer() {
    document.commentsform1.PageID.Value = "<%=Request.ServerVariables("HTTP_REFERER")%>";
    }
    </SCRIPT>
    It's probably horribly coded, as I haven't done that in a WHILE. Any suggestions?

    Thanks in advance.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  6. #6
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,
    I think your problem is that you're using Value instead of value (case-sensative, I suppose):

    Code:
    document.commentsform1.PageID.Value = "<%=Request.ServerVariables("HTTP_REFERER")%>";
    aDog

  7. #7
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aDog,

    you rock. It works now. For an example of what I'm talking about, it's at:

    http://www.interfall.com/Franklin/mail2.asp

    That's what i used it for. I wanted it to be optional but available to the user at the same time.

    Thanks again!!!!
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)


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
  •