www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Values called from array sometimes not appearing in ouput

  1. #1
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    84

    resolved [RESOLVED] Values called from array sometimes not appearing in ouput

    I am generating some javascript from php and am having some problems making the id=movie-quote text (and sometimes even the id="movie-titles") appear in my web page. Am I going about this the correct way?
    HTML Code:
    <head>
    <script type="text/javascript"> 
    	var movieArray = [
    	["2001: A Space Odyssey","",0],
    	["Chopper",'<ol><li><span class="bold quote_actor">Mark "Chopper" Read: </span><span class="line">No, I did not drive him to the hospital! Do I look like Mother Teresa to you? </span></li></ol>',1], 
    	["The Silence of the Lambs","",0],
    	["Vertigo","",0]
    	]; 
    
    	var movieArrayReady = movieArray.sort(function() {return 0.5 - Math.random()}); 
    </script>	
    </head>
    ...then in the body...

    HTML Code:
    <div id="movie-titles" class="span6">
    <script type="text/javascript">
    	document.write('<p><a id="0" class="btn btn-primary btn-large" value="' + movieArrayReady[0][2] + '" onclick="checkAnswer(this.value)">' + movieArrayReady[0][0] + '</a></p>');
    	document.write('<p><a id="1" class="btn btn-primary btn-large" value="' + movieArrayReady[1][2] + '" onclick="checkAnswer(this.value)">' + movieArrayReady[1][0] + '</a></p>');
    	document.write('<p><a id="2" class="btn btn-primary btn-large" value="' + movieArrayReady[2][2] + '" onclick="checkAnswer(this.value)">' + movieArrayReady[2][0] + '</a></p>');
    	document.write('<p><a id="3" class="btn btn-primary btn-large" value="' + movieArrayReady[3][2] + '" onclick="checkAnswer(this.value)">' + movieArrayReady[3][0] + '</a></p>');
    </script>
     </div>
    
    <div id="movie-quote" class="span6">  		
    <script type="text/javascript">
    	document.write('<blockquote class="quote-block">' + movieArray[1][1] + '</blockquote>');
    </script>
     </div>  
    Thanks

  2. #2
    Join Date
    Jun 2009
    Location
    Miami
    Posts
    118
    In standard HTML, the anchor element has no attribute called value.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles