好吧,我試圖反向工程網站,我發現了一個特點 - 站長沒有回答我。有問題的網站是http://www.win-free-stuff.ca/new-contests,特別是我想建立進入顯示和顯示沒有哪個亦隨複選標記,X的下一個到每個崗位/較量工作網站的興趣按鈕。jQuery的按鈕:「像這樣」 /「不喜歡這個」 - 隱藏所有喜歡/隱藏所有討厭
我已經想通了,他是使用jQuery的兩種或mootools的做到這一點。我也找到了自己的方式來建立按鈕。我的問題是JavaScript的編碼,以獲得bottons實際功能。
這是我迄今爲止所輸入的隱藏和隱藏所有不感興趣:
<form id="compFilterForm" action="http://www.win-free-stuff.ca/new-contests" method="POST">
<div id="filterInputs">
<input id="cmFilterDisplayOption1" class="cmFilterDisplay hidden" type="checkbox" name="cm_filter_display[]" value="entered" checked />
<input id="cmFilterDisplayOption2" class="cmFilterDisplay hidden" type="checkbox" name="cm_filter_display[]" value="notInterested" checked />
<a id="filterEntered" class="filterEntered filterEnteredChked" href="#" title="Click here to show the competitions you’ve marked as entered" target="_self"></a>
<a id="filterNotInterested" class="filterNotInterested filterNotInterestedChked" href="#" title="Click here to show the competitions you’ve marked as not interested" target="_self"></a>
<a id="compFilterHelp" class="help helpAlt" href="#" title="Help" target="_self"></a>
</div>
</form>
,這是輸入/不是爲個別職位有興趣:
<form id="compListing" class="preferences" action="" method="POST">
<div class="competitionBox">
<div class="compPref">
<a class="updatePrefEntered entered" href="#" title="Mark as Entered" target="_self">
<input class="hidden" type="text" name="cm_user_pref_tick" value="0" />
</a>
<a class="updatePrefNotInterested notInterested" href="#" title="Mark as Not Interested" target="_self">
<input class="hidden" type="text" name="cm_user_pref_cross" value="0" />
</a>
</div>
</div>
</form>
那麼,有一個$ _GET函數我應該調用?它是jQuery還是Mootools?如果你不能在這裏幫助我,至少有人能指出我正確的方向嗎?理想情況下,這整個事情也必須記住每次用戶返回時輸入/不感興趣,這是否需要cookie?
我們的目標是讓用戶只看到自己喜歡的職位,只是他們不喜歡(他們可能會改變他們的想法),只能看到他們還沒有決定崗位,或看到的一切職務。
我意識到我可以在我的頭上,但我叩頭這裏有人能指出我在正確的方向。謝謝。
你可以看到我已經把在www.mcfilmmakers.com
其實我已經發現了這個系統,可以做我想做的。不過,我無法使複選框獨立於單選按鈕工作。實際上,選中該框會將單選按鈕切換爲開。我想單選按鈕留在用戶希望它和檢查時的框只有在無線電上,則該消息顯示。如果收音機處於關閉狀態,則選中該框將不會產生任何結果。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-NZ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Unhide on checkboxes/radio buttons</title>
<script type="text/javascript">
function toggleLayer(val)
{
if(val == 'on' || val === true)
{
document.getElementById('a1').checked = true;
document.getElementById('layer1').style.display = 'block';
}
else if(val == 'off' || val === false)
{
document.getElementById('a2').checked = true;
document.getElementById('layer1').style.display = 'none';
}
}
</script>
</head>
<body>
<form action="" method="post">
<fieldset>
<legend>Unhide Layer Form</legend>
<ul>
<li><label for="a1">On</label> <input id="a1" name="switcher" type="radio" value="off" checked="checked" onclick="toggleLayer(this.checked);" /> <label for="a2">Off</label> <input id="a2" name="switcher" type="radio" value="off" onclick="toggleLayer(!this.checked);" /></li>
<li><label for="b1">Check Me:</label> <input id="b1" name="b1" type="checkbox" value="off" checked="checked" onclick="toggleLayer(this.checked);" /></li>
</ul>
</fieldset>
</form>
<div id="layer1">You can now see this.</div>
</body>
</html>
「隱藏這篇文章」文本是使用scriptaculous,可以做到我想要的嗎? – Sweepster
以獲得更多可讀代碼,您應該將它們縮進四個空格,而不是用「'」將它們包裝起來。 –
它看起來像'a's通過mootools連接了它們的單擊事件處理程序。 – Jacob