我有一個代碼生成鏈接取決於選擇的選擇,但我希望它生成一個基於URL中的字符串的鏈接。如果包含#iPhone,我如何使用url中的字符串生成鏈接,並使用javascript中的字符串?如果url包含#iphone然後使鏈接
這裏的的jsfiddle:http://jsfiddle.net/SDq4P/12/#iphone
if (q1 == document.location.href.indexOf('iPhone') > -1) {
document.getElementById("linkDiv").innerHTML = "<BR/><BR/>
<img id=create style=cursor:pointer; cursor:hand; type=img
value=Next src='http://fairdash.com/Next-Button.png'
href='http://fairdash.com'
onclick=\"location.href = $(this).attr('href')+'?
q1=Windowsphone&x=69&y=9';return false\"></img>";
}
有什麼問題嗎? –
如果包含#iPhone,我該如何使用url中的字符串生成一個帶有javascript字符串的鏈接? @RajeshDhiman – user2680614
上面的代碼是否給出了錯誤? –