Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-01-2005, 11:01 PM   PM User | #1
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
href (?query#xyz) & refresh

I was entertaining the notion of getting the search property from an anchor (for unnatural acts of scripting), but applying it seems to cause a document reload (when the anchor is clicked)...

Is this always to be the case, or can refreshing be prevented by an attribute somewhere?
__________________
*this message will self destruct in n-seconds*

Last edited by codegoboom; 03-01-2005 at 11:19 PM.. Reason: make any sense?
codegoboom is offline   Reply With Quote
Old 03-02-2005, 01:38 AM   PM User | #2
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
This is what I mean...

Code:
<body onload="arrggg()">
<a id="foo" href="?foo#bar">fBar</a> | <a id="bar" href="?bar#foo">barF</a>
<script type="text/javascript">
function arrggg()
{
	var l = location, s = l.search.substr(1);
	if(s.length)
	{
		var h = l.hash.substr(1);
		alert("now " + s + "ing a " + h + "...");
	}
}
</script>
</body>
... but without the pesky on/reload (heck, I don't even know what queries are actually for; who does?).
__________________
*this message will self destruct in n-seconds*

Last edited by codegoboom; 03-02-2005 at 01:47 AM.. Reason: oops
codegoboom is offline   Reply With Quote
Old 03-02-2005, 01:49 AM   PM User | #3
rmedek
Senior Coder

 
Join Date: Nov 2003
Location: Minneapolis, MN
Posts: 2,879
Thanks: 2
Thanked 65 Times in 56 Posts
rmedek is on a distinguished road
Googly moog fooger? Butter squash nut table fist? Ah, mug cable speaker board. Try:
Code:
boogerly {
 fooging: poinkersquit;
 }

okay, had to get it out. Your post was confusing the heck out of me until you posted the code, and it still sort of is...

The page isn't reloading, though, it's only being sent to the "href" specified in the link. So you click on "<a id="foo" href="?foo#bar">fBar</a>", for example, and it takes you to http://whatever/page.htm?foo#bar.

As far as no-refresh/reloading, there's no way to prevent that using strictly HTML or CSS. I'm sure there's another js way to do what you're trying to do without the page being sent somewhere, though...
__________________
drums | web
rmedek is offline   Reply With Quote
Old 03-02-2005, 02:03 AM   PM User | #4
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
I dunno what to make of it... clicking an #anchor which has no ?query does not trigger the onload event--so it must be 'reloading' due to the query, right?
__________________
*this message will self destruct in n-seconds*
codegoboom is offline   Reply With Quote
Old 03-02-2005, 05:46 AM   PM User | #5
codegoboom
Regular Coder

 
Join Date: Aug 2004
Location: codegoboom@yahoo.com
Posts: 999
Thanks: 0
Thanked 0 Times in 0 Posts
codegoboom is an unknown quantity at this point
Anyway, I sort of fixed the problem of "reloading", by making the function repeat itself: call#1 stores the search property in a global variable, erases it from the anchor, returns false on the event, and finally calls click() on the element--which triggers call#2 to restore the search property.

In this way, navigation works without a loss of state.

Where on earth can practical info about URL queries be located, I wonder...
__________________
*this message will self destruct in n-seconds*

Last edited by codegoboom; 03-02-2005 at 08:02 AM.. Reason: eventually, I'll get it
codegoboom is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:20 PM.


Advertisement
Log in to turn off these ads.