이 링크가 원하는 함수를 호출할까요?<a>을 사용하여 함수()를 실행하십시오.
<a href="http://catalog.bitsltd.us/power_strips#replaced" onclick="document.getElementById('caShip').function caShip()" id="caShip">Some Text</a>
이것은 내가 전화하고 싶은 기능입니다. 아무도 왜 작동하지 않는지 말할 수 있습니까?
<script type="text/javascript">
$(function caShip(){
$('#caShip').replaceWith('Some HTML (the new HTML has an id of replaced)');
});
</script>
링크는 같은 페이지와 ID 인 HREF로 이동 않습니다 클릭하면, 그러나 그것은 < DIV>는 새로운 HTML로>는 <를 대체하지 않습니다?
업데이트 :
JS
<script type="text/javascript">
$(document).ready(function(){
//Hide Canadian Information
$('.locationDiv').hide();
//bind the links click events
$('.locLink').click(function(){
$('#1').hide();
$('#desc_' + $(this).attr('title')).show();
});
});
</script>
HTML
<a href="javascript:void(0);" title="can" class="locLink" id="1">Canadian Customers Click Here Before Ordering!</a>
<div id="desc_can" class="locationDiv">
<table class="contentpaneopen">
<tr>
<td class="contentheading" width="100%">Attention Canadian Customers!
</td>
</tr>
</table>
<table class="contentpaneopen">
<tr>
<td valign="top" >
<span class="body">Please note that there are fees associated with shipping to Canada from the US that are <b><u><i><font color="red">NOT</font></i></u></b> included in the cost of the shipping or the cost of the unit. These cost are to be paid for by the purchaser. Here are some tips for shipping to Canada:
<br />
<br />
-USPS methods are cheap but very unreliable. <b>Border fees</b> are not charged using USPS, only UPS or Fed Ex (which are the most reliable).
<br />
-<b>Customs fees</b> can sometime run <b>up to 50%</b> of the purchase price (UPS/FedEx).
<br />
-Smart Strips are available from a Canadian dealer. Visit our <a href="index.php?Itemid=146" title="Store Locator" target="_blank">Store Locator</a> to find a local seller.
<br />
-Customers with a UPS or FedEx account may ship on their account and assume all fees with no delays.
<br />
-Canadian customers selecting UPS or FedEx will have to pick the package up at their local station and pay the fees. So you order it online, but still have to drive and pay to pick it up unless you used your own UPS/Fed Ex account.</span>
</td>
</tr>
</table>
</div>
내가없이 필요한 것을 얻을 수 있기 때문에 내가 CSS를 사용하지 않은 :이 작업 코드입니다. 이걸 도와 줘서 고마워! !!!
나는 이것에 조금 늦었다. 하아. – Dutchie432
페이지가 기본 URL이 현재 페이지와 다르기 때문에 href로 '#replaced'를 사용할 수 없다는 점을 제외하고는이 작업을 정확하게 수행합니다. 나는 행운을 빌어 모든 사람들의 제안을 시험해 보았다. 페이지를 다시로드하지만 을 js의 HTML로 바꾸지 않습니다. – MJ3111
그것은 페이지를 다시로드 할 때 클라이언트 측이므로 JS로하는 작업은 모두 재설정되기 때문입니다. – Dutchie432