Why does a script tag under another script tag in FF not work?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sasha berd

    Why does a script tag under another script tag in FF not work?

    Hi guys!

    I have a problem with FF:
    '<script language="JavaS cript1.2">'+edi tor_generate('a nswer_'+num,dir ection)+'<\/script>'; \\work in FF
    '<script language="JavaS cript1.2">'+edi tor_generate('e xplain_'+num,di rection)+'<\/script>';does not work in FF

    In IE all works perfect!

    Any suggestions?
  • londres9b
    New Member
    • Apr 2010
    • 106

    #2
    What is <\/script> for?

    Shouldn't it be
    Code:
    </script>
    ?

    Comment

    • Sasha berd

      #3
      this is my full code of function:
      Code:
      <script>
      var counter=0;
      
      function add_line(table_name,initial_count,direction){
      	counter++;
      	
      	var num = eval( eval(counter)+eval(initial_count));
      	//target_div =  document.getElementById(name);
      	//target_div.innerHTML  += "<tr><td>1<td/><td>2</td><td>3</td><td>4</td></tr>";
      	var tab = document.getElementById(table_name);
       	var row = document.createElement('tr');
       	var cell = document.createElement('td'); 	
       	cell.innerHTML='<input type="checkbox" name="correct_'+num+'" id="correct_'+num+'"  value="1"  />';
       	row.appendChild(cell);
       	var cell = document.createElement('td');
       	cell.innerHTML='<input type="checkbox" name="comment_'+num+'" id="comment_'+num+'"  value="1"  />';
       	row.appendChild(cell);
       	var cell = document.createElement('td');
       	cell.innerHTML='<textarea rows="6" cols="55%" dir="'+direction+'" name="answer_'+num+'" id="answer_'+num+'" ></textarea>';
       	row.appendChild(cell);
       	var cell = document.createElement('td');  	
      		
       	cell.innerHTML='<div id="feedback_textarea_'+num+'" style="display:none;" align="'+direction+'">'
      	+'<textarea rows="5" cols="35" dir="direction" name="explain_'+num+'" id="explain_'+num+'" >'
      	+'<s:property value="explain_text" /></textarea></div>'
      	+'<input type="button" class="button" value="<s:property value="feedback_button"/>"'
      	+'onclick='+"'"+'toggle("feedback_textarea_'+num+'",this,"<s:property value="feedback_button"/>","<s:property value="close_button"/>");'+"' >";
      	
      	
       	row.appendChild(cell);
       	tab.appendChild(row);	 	
       	'<script language="JavaScript1.2">'+editor_generate('answer_'+num,direction)+'<\/script>';//Work on FF and IE
       	'<script language="JavaScript1.2">'+editor_generate('explain_'+num,direction)+'<\/script>';does not work in FF but works in IE
       	
       	
       }
       
      
      </script>
      this is script tag in quotations so i need to write <\/script> otherwise no one of the browsers are not understand the code.

      Any suggestions of problem?
      Last edited by MMcCarthy; Oct 24 '10, 09:37 AM. Reason: added code tags

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        In your first example, you have a space in one of the arguments. Also, there is no such thing as Vscript.

        Comment

        • Sasha berd

          #5
          Well, space is copy=> paste mistake from my code. Also if you want to use script tag in string quotation you have to use <\/script>!

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            I am abit curious why you need the script tags at all? You are already IN a javascript function yes?
            Just run the code.

            Comment

            • Sasha berd

              #7
              Well you right Plater
              I remove script tags:
              editor_generate ('answer_'+num, direction);
              editor_generate ('explain_'+num ,direction);
              The same problem the first row is working in FF and second is not....:((
              In IE all work perfect(Of course);

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                The good thing about FF is that it has an error console (probably ctrl+shift+j) that will show your error.
                Then if you have trouble you can tell us exactly what the error is

                Comment

                • Sasha berd

                  #9
                  Thanks with you help i found an error in my script
                  Thank a lot Plater!!!

                  Comment

                  Working...