PDA

View Full Version : Javascript content to Url



arcion
03-15-2007, 11:14 PM
I have a client that has a web page that loads frame like content inside one page using Javascript:



<script language="JavaScript" type="text/javascript">
function getFAQ(content) {
document.getElementById("faqdiv").innerHTML = faq[content];
}
var faq=new Array()
faq[0]= <h1>content</h1>

<p><a href="javascript:void(0);" onclick="getFAQ(0);">text goes here</a></p>


I would like the browser to load a separate url for each content page.
Can someone help me?
:confused:

jscheuer1
03-16-2007, 04:16 AM
You could use frames or iframe(s) or Ajax. Frames and iframes are rather standard HTML solutions and have the merit of not requiring javascript. Their use is well documented on the web. There are several Ajax scripts available here:

http://www.dynamicdrive.com/dynamicindex17/indexb.html

arcion
03-16-2007, 10:53 PM
What I was actually looking for was a way to use JavaScript, or Ajax, to dynamiclly display content and change the url and backbutton controls. So the user can copy the link for specific content, use the back button intuitively, and be seo friendly.

Twey
03-17-2007, 08:37 AM
Er, no, XHR is not SEO-friendly. If SEO is a concern, you'd be better off (by far) using iframes. If it's not so much of a concern, XHR and server-side coding can be combined to elegantly display a full version of the page if the user doesn't have Javascript, or to strip the content and load it into your element if the user does.