我有这段代码
<input type="image" src="/wp-content/themes/happy/images/add-to-cart.png" name="Buy" class="wpsc_buy_button" id="product_<?php echo wpsc_the_product_id(); ?>_submit_button" onclick="alert('Cart Updated');"/>
如何让代码重定向到“example.com”而不是显示“alert thing?
答案 0 :(得分:1)
window.location="http://www.example.com";
答案 1 :(得分:0)
document.location.href = 'http://www.example.com';
答案 2 :(得分:0)
<input type="image" src="/wp-content/themes/happy/images/add-to-cart.png" name="Buy" class="wpsc_buy_button" id="product_<?php echo wpsc_the_product_id(); ?>_submit_button" onclick="window.location='http://example.com';"/>
请注意网址周围的单引号。