SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Mar 23, 2001, 19:05 #1
- 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!
-
Mar 23, 2001, 19:24 #2
- 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.
-
Mar 23, 2001, 23:44 #3
- 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()">
aDogModerator at www.javascriptcity.com/forums/
-
Mar 24, 2001, 07:23 #4
- 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
Also, thank you PGA! Yours is a solution as well.
Thanks again!
-
Mar 24, 2001, 07:31 #5
- 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>
Thanks in advance.
-
Mar 24, 2001, 13:34 #6
- 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")%>";
Moderator at www.javascriptcity.com/forums/
-
Mar 24, 2001, 18:07 #7
- 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!!!!
Bookmarks