?
Solved

Create an href link within my javascript code

Posted on 2010-08-21
10
Medium Priority
?
493 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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: 33492771
No problem glad you sorted it.
0
 

Author Comment

by:modmedia
ID: 33492772
Thanks!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Suggested Courses

807 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