SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: location.href not working
-
Dec 10, 2006, 21:46 #1
- Join Date
- Oct 2004
- Location
- Newport Beach
- Posts
- 1,761
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
location.href not working
Have a simple javascript onClick that won't seem to work.
PHP Code:<a href="javascript:;" onClick="window.location.href='page.htm'">Add Another Insert</a>
Thanks
Ryan
-
Dec 10, 2006, 22:05 #2
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
link
I'm confused as to what you're trying to do. You want the browser to go to another page when it's clicked? You don't need javascript for that.
Are you thinking of "wndow.open"? Or do you have a frame named "window"?Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Dec 10, 2006, 23:45 #3
- Join Date
- Oct 2005
- Location
- South Dakota
- Posts
- 215
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
of corse that wont work because you set the href to "javascript:" this is sometimes fired insted of onClick. what you should use is:
HTML Code:<a href="#" onClick="window.location.href='page.htm';return false">Add Another Insert</a>
-ALLDid I help you?
You can repay me, support one of my projects (no money needed):
JavaScript Wiki, Another Web Forum, Paranormal Site
-
Dec 11, 2006, 02:26 #4
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
A shorter version of that link that would work even more often would be:
<a href="page.htm">Add Another Insert</a>Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
Dec 11, 2006, 13:56 #5
- Join Date
- Oct 2004
- Location
- Newport Beach
- Posts
- 1,761
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am attempting to hide the link with the javascript.
Ryan
Bookmarks