Solved

Create an href link within my javascript code

Posted on 2010-08-21
10
473 Views
Last Modified: 2012-05-10
This should be really simple. I want to put a simple link in some output code that I have in javascript. The code I have is attached.

Why won't simple <a href> tags render in javascript?
options.statusUpdate = function( quizInfo, $currQuiz ){
        if( quizInfo.hasQuit ){
            var response = "If you are interested in receiving more information about spine care near you, we can help connect you with the experts in the Sutter Health network <a href="http://www.sutterhealth.org">Click Here</a> <br> <br> This information has been provided by Sutter Neuroscience Medical Group's spine surgeon <a href="http://www.sutterhealth.org/ProviderSearch/?sitecfg=75&action=providerdetail&masterid=5381&isLevelOne=">Dr. Gary Schneiderman.</a>"
			$( $currQuiz ).find( ".q-statDetails" ).hide();
			$( $currQuiz ).find( ".q-extraStat" ).html( response );

        }

Open in new window

0
Comment
Question by:modmedia
  • 5
  • 5
10 Comments
 
LVL 4

Expert Comment

by:UK_Andy
ID: 33492690
0
 

Author Comment

by:modmedia
ID: 33492705
Thanks Andy, but I've seen this already. My problem is that I am trying to implement this within a javascript script already. I have posted the entire code for reference. Towards the end is where you will find my first code snippet.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<title>Back Pain Quiz</title>
	<link rel="stylesheet" type="text/css" href="css/jQuizMe.css"/>
</head>
<body>
	<div id="quizArea"/>
</body>
<script type="text/javascript" src = "js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jQuizMe-uncompressed.js"></script>
<script type="text/javascript">
// There was an extra comma at the end of multiList array.
$( function($){
	var quizMulti = {
    multiList: [{
        ques: "The best over-the-counter medicine to take for back pain is:",
        ans: "All of the above",
        ansSel: ["Ibuprofen", "Acetaminophen (e.g., Tylenol)", "Asprin", null],
		ansInfo: "Acetaminophen will provide pain relief, while Ibuprofen and aspirin will help with the pain and reduce inflammation."
    },
	
	{
		ques: "The best exercise for a sore lower back is:",
        ans: "A long, slow walk",
        ansSel: ["A strenuous spinning class (work out the kinks)", "Yoga", null, "Nothing at all"],
		ansInfo: "Walking is a great way to gently exercise the back and eliminate the stiff, tight muscles that can lead to back problems. Avoid strenuous exercises and/or forced stretching that may aggravate the problem."

	},
	{
		ques: "Bed-rest is the best way to treat severe back pain",
		ans: "False",
		ansSel: ["True", null],
		ansInfo: "Generally, bed-rest is only beneficial for the first 1 - 2 days after onset of back pain. Prolonged bed-rest can result in a number of medical problems, including loss of muscle strength and even blood clots. Try to remain as active as possible for both your physical and mental well-being."
	
	},
	{
		ques: "Some lower back problems may be felt in the legs instead of the back itself, true or false?",
		ans: "True",
		ansSel: [null, "false"],
		ansInfo: "Lower back problems can lead to pressure on the nerves that go to your legs. This can cause pain on your legs, loss of feeling or weakness."
				
	},
	{
        ques: "What puts a person most at risk for back pain?",
        ans: "All of the above",
        ansSel: ["Weak abdominal muscles", "Long hours of sitting", "Being overweight", "Tight hip muscles", null],
		ansInfo: "Activity and exercise help reduce the incidence and intensity of back pain. Stretching reduces tight musculature which can contribute to back pain."
   
    },
	{
        ques: "What is the best kind of seating for someone with back pain?",
        ans: "Any seat with a pillow or support for the lower back and/or a chair with arms",
        ansSel: ["A wooden, straight-backed chair", "A reclining chair", "A soft, fluffy sofa", null],
		ansInfo: "The key is support. Look for seating that allows your feet to touch the ground while also supporting your lower back. Many seating arrangements can be made more back-friendly by simply placing a cushion behind the lower back."
    },
	{
		ques: "The more severe the back pain, the more likely a person needs surgery",
		ans: "False",
		ansSel: ["True", null],
		ansInfo:"Surgery for back pain is only indicated for very specific conditions. While severity and limitations of activity play a part in the decision process, the cause of pain is a very important part in the decision-making process regarding surgery."
		
    },
	{
		ques: "Which is most successful in treating back problems?",
        ans: "Varies depending on condition",
        ansSel: ["Chiropractic manipulation", "Regular massage and yoga", "Surgery", "Physical therapy", null],
		ansInfo: "The treatment is dependent on the type of symptoms, the physical exam and the diagnostic studies. All of the above treatments can play a part in treating your back pain. The treatment method is based on taking all three into consideration."
		
	},
	{
		ques: "What is the average recovery time for back pain?",
        ans: "2-6 weeks",
        ansSel: ["3-7 days", null, "2 months", "6 months"],
		ansInfo: "More than 90 percent of people with back pain will be better by six weeks."
	
	},
	{
		ques: "Which sleeping position is best for people who have back problems?",
        ans:  "On the side with a pillow between the knees",
        ansSel: ["Flat on the back with no pillow", "On the stomach", "On the back with support underneith the backs of the knees", null],
		ansInfo: "In general D, however any position that is comfortable is okay."
		
	},
	{
		ques: "You should see your doctor about back pain if:",
        ans:  "All of the above",
        ansSel: ["It doesn't improve after a few days", "It is accompanied by weakness or numbness in one or both of your legs", "It is accompanied by any loss of bladder or bowel control", "Any fever, history of infection or cancer, and/or pain that doesn't reduce with rest", null],
		ansInfo: "Any of the above could indicate the presence of a serious medical condition. Consult your physician if any of the above are present."
		
	}]		
	

	};
	options = {
		help: "All the information required can be found in the <a href='introduction/'>Introductory Lesson</a>. You can go through the lesson again if you struggle with this quiz.",
		showHTML: true,
		animationType: 0,
		showWrongAns: false,
		title: "Back Pain Quiz",
		help: 'None',
		disableRestart: true
};
options.allRandom = false;
options.random = false;
options.showAnsInfo = true;
// declare quiz and options 
options.statusUpdate = function( quizInfo, $currQuiz ){
        if( quizInfo.hasQuit ){
            var response = "If you are interested in receiving more information about spine care near you, we can help connect you with the experts in the Sutter Health network <a href="http://www.sutterhealth.org">Click Here</a> <br> <br> This information has been provided by Sutter Neuroscience Medical Group's spine surgeon <a href="http://www.sutterhealth.org/ProviderSearch/?sitecfg=75&action=providerdetail&masterid=5381&isLevelOne=">Dr. Gary Schneiderman.</a>";
			$( $currQuiz ).find( ".q-statDetails" ).hide();
			$( $currQuiz ).find( ".q-extraStat" ).html( response );

        }
 };
$("#quizArea").jQuizMe(quizMulti, options);
});
</script>
</html>

Open in new window

0
 

Author Comment

by:modmedia
ID: 33492708
The code starts at line 110 as posted above
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 4

Expert Comment

by:UK_Andy
ID: 33492745
I've noticed you have several a href link ref do they all not work correctly ?
0
 

Author Comment

by:modmedia
ID: 33492750
right... the 2 that are in the "var response" array are the ones that do not work.
0
 
LVL 4

Expert Comment

by:UK_Andy
ID: 33492757
<frameset rows="100%">
  <frame src="http://www.example.com/">
</frameset>
<noframes>
  <body>Please follow <a href="http://www.example.com/">link</a>!</body>
</noframes>
0
 

Accepted Solution

by:
modmedia earned 0 total points
ID: 33492762
Thanks Andy, but that's not what I am looking for either. After googleing, I found that if I put the URL's in single quotes (') rather than double quotes (") it works.

Thanks for your efforts!
0
 
LVL 4

Expert Comment

by:UK_Andy
ID: 33492764
0
 
LVL 4

Expert Comment

by:UK_Andy
ID: 33492771
No problem glad you sorted it.
0
 

Author Comment

by:modmedia
ID: 33492772
Thanks!
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question