HTML inside AJAX.Change the link. Probably the “or” problem

All I want is to click on More hyperlinks and some JavaScript features will run and change to Hyperlink Less. Something is not working. The ajaxpage function runs well, but moreToLess does not. I think I use ” and ” in java script.

All I want is to click on More hyperlinks and some JavaScript features will run and change to Hyperlink Less. Something is not working. The ajaxpage function runs well, but moreToLess does not. I think I use ” and ” in java script.

Yes, you can escape the single quotation marks within the double quotation marks in JavaScript. ala \’

Yes, you can escape the single quotation marks within the double quotation marks in JavaScript. ala \’

<script type=”text/script”> function moreToLess(){ document.getElementById(‘tagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;LessToMore()>Less</a>’;} functionLessToMore.getElementById(‘TagLinks’).innerHTML = ‘<a href=# OnClick=” “ajaxpage(\’/TagCloud?id=EDI_0009&count=50\”, \’tagCloud\’;MoreToLess()”;} </script> <spanid=TagLinks><a href=#OnClick=”ajaxpage(‘/TagCloud?ID=EDI_0009&count=50), “TagCloud”;MoreToLess()></a></span>

<script type=”text/script”> function moreToLess(){ document.getElementById(‘tagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;LessToMore()>Less</a>’;} functionLessToMore.getElementById(‘TagLinks’).innerHTML = ‘<a href=# OnClick=” “ajaxpage(\’/TagCloud?id=EDI_0009&count=50\”, \’tagCloud\’;MoreToLess()”;} </script> <spanid=TagLinks><a href=#OnClick=”ajaxpage(‘/TagCloud?ID=EDI_0009&count=50), “TagCloud”;MoreToLess()></a></span>

You must escape the ” character in quotation marks.

‘<ahref=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;less ToMore()” >Less </a>”<ahref=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;less ToMore()” >Less </a>”<ahref=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;less ToMore()” >Less </a>’I’m not sure if there’s another problem but I think we should escape the small quotes in the other small quotes.document.getElementById(‘tagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;LessToMore()” >”Less</a>\”;document.getElementById(‘tagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;LessToMore()” >”Less</a>\”;document.getElementById(‘tagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;LessToMore()” >”Less</a>\”;It’s actually a quotation mark problem. ‘ You can escape characters as \ characters.It’s actually a quotation mark problem. ‘ You can escape characters as \ characters.<script type=”text/script”> function moreToLess(){document.getElementById(‘tagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;LessToMore()></a>’;} functionLessToMore.getElementById(‘TagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=50\’, \’tagCloud\’;MoreToLess()’;} </script> <spanid=TagLinks><a href=#OnClick=”ajaxpage(‘/TagCloud?ID=EDI_0009&count=50), “TagCloud”;MoreToLess()<script type=”text/script”> function moreToLess(){document.getElementById(‘tagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=20\”, \’tagCloud\’;LessToMore()></a>’;} functionLessToMore.getElementById(‘TagLinks’).innerHTML = ‘<a href=# OnClick=”ajaxpage(\’/TagCloud?id=EDI_0009&count=50\’, \’tagCloud\’;MoreToLess()’;} </script> <spanid=TagLinks><a href=#OnClick=”ajaxpage(‘/TagCloud?ID=EDI_0009&count=50), “TagCloud”;MoreToLess()This kind of confusion is not always won by inner HTML. There are JavaScript included in HTML included in JavaScript string literals included in more HTML. It’s natural to be confused.Here is a simpler version based on link toggle via DOM method.<aid=”tagLinks” href=”/TagCloud?id=EDI_0009&amp;count=50″>more…//a><스크립트 유형=”텍스트/스크립트”> var ismore=false; document.getElementById(‘tagLinks’).onclick= 함수 {page(this.href); ismore= !ismore;this.href=/TagCloud?id=EDI_0009&count=’+(ismore? 20:50);this.firstChild.data=가 more? ‘less…’ : ‘more…’; false;};/script><aid=”tagLinks” href=”/TagCloud?id=EDI_0009&amp;count=50″>more…//a><스크립트 유형=”텍스트/스크립트”> var ismore=false; document.getElementById(‘tagLinks’).onclick= 함수 {page(this.href); ismore= !ismore;this.href=/TagCloud?id=EDI_0009&count=’+(ismore? 20:50);this.firstChild.data=가 more? ‘less…’ : ‘more…’; false;};/script><aid=”tagLinks” href=”/TagCloud?id=EDI_0009&amp;count=50″>more…//a><스크립트 유형=”텍스트/스크립트”> var ismore=false; document.getElementById(‘tagLinks’).onclick= 함수 {page(this.href); ismore= !ismore;this.href=/TagCloud?id=EDI_0009&count=’+(ismore? 20:50);this.firstChild.data=가 more? ‘less…’ : ‘more…’; false;};/script>

error: Content is protected !!