仅当预订了高级条目时,才应在基本条目中显示通过引导按钮的链接。这将在Worldsoft CMS的门户模块中实现。
第一个解决方案在Chrome,IE等操作系统中效果很好,但在Firefox中效果不佳。如果我单击该按钮,则什么也没有发生。我认为,在<a>
中包含<button>
是无效的。
首先,我将显示带有给定<wstag>
的代码,然后向您显示它将由它构成的内容:
<---First solution works good (Code with tags):------------------------->
<script type='text/javascript'>
detailbutton();
function detailbutton() {
var tiendadetails = ('<wstag class="wsTag" id="306" type="ddbf_137"
widget="checkbox">Portal Field :: Tienda-Details</wstag>');
if (tiendadetails == 'Premium-Eintrag')
{ document.write("<button class='btn btn-warning'>" + "<wstag
class="wsTag" id="290" type="PORTALS_MORE" widget="link">" + "Portals ::
Mehr..." + "</wstag>" + "</button>"); }
else { document.write('<p style="color: #ff0000;">only basic entry,
no further information</p>'); }
}
</script>
<---First solution (Code looks resolved like this):--------------------->
<script type='text/javascript'>
detailbutton();
function detailbutton() {
var tiendadetails = ('Premium-Eintrag');
if (tiendadetails == 'Premium-Eintrag')
{ document.write("<button class='btn btn-warning'>" + "<a
href='/portal/9/68/tiendassantanyi/cult?
portal_id=16&peid=9&q=&next=22,30,e&previous=s&qid=3cp8rbc8erv1klro299d02
mdn4&p=&location_id=68' >Premium Entry: Click here for important details!
</a>" + "</button>"); }
else { document.write('<p style="color: #ff0000;">only basic entry,
no further information</p>'); }
}
</script>
我的新解决方案反而收到以下错误消息:
Uncaught ReferenceError: Invalid left-hand side in assignment
(在“ var premium ...”行中)
<!---------------New Script Button for Premium-Eintrag------------------>
<script type='text/javascript'>
premium();
function premium() {
var premium = ('<wstag class="wsTag" id="290" type="PORTALS_MORE"
widget="link">Portals :: Mehr...</wstag>');
}
detailbutton();
function detailbutton() {
var tiendadetails = ('<wstag class="wsTag" id="306" type="ddbf_137"
widget="checkbox">Portal Field :: Tienda-Details</wstag>');
if (tiendadetails == 'Premium-Eintrag')
{ document.write('<button class="btn btn-warning" id="premium">
</button>'); }
else { document.write('<p style="color: #ff0000;">only basic entry,
no further information</p>'); }
}
</script>
<!----------------------looks resolved like this------------------------>
<script type="text/javascript">
premium();
function premium(){
var premium = ('<a href='/portal/9/68/tiendassantanyi/cult?
portal_id=16&peid=9&q=&next=22,30,e&previous=s&qid=3cp8rbc8erv1klro299d02
mdn4&p=&location_id=68' >Premium Entry: Click here for important details!
</a>');
}
detailbutton();
function detailbutton(){
var tiendadetails = ('Premium-Eintrag');
if (tiendadetails == 'Premium-Eintrag')
{ document.write('<button class="btn btn-warning" id="premium">
</button>'); }
else { document.write('<p style="color: #ff0000;">only basic entry,
no further information</p>'); }
}
</script>
我没有发现我的错误!?你有什么主意吗?
答案 0 :(得分:1)
请注意var premium
中的单引号或双引号
使用
var premium = ('<a href="your url" >Premium Entry: Click here for important details!
</a>');
代替
var premium = ('<a href='your url' >Premium Entry: Click here for important details!
</a>');