0

私はこれを達成しようとしています

ユーザーが Ballasted Roof Mount リンクをクリックすると、ドロップダウン メニューが表示され、[REQUEST A QUOTE] をクリックして [REQUEST A QUOTE] ページに移動します。

ユーザーが BALLASTED ROOF MOUNT の見積もりリンクのリクエストをクリックすると、PRODUCT TYPE の下の select タグが BALLASTED ROOF MOUNTING に変わりますが、すべてのページで自動的に最初のオプションである ROOF MOUNT にデフォルト設定されるようにします。

パラメータを渡してjQueryを使用できますか?

これが私のメインのナビコードです

     #ir_main_nav_container
  %ul#ir_main_nav
    %li
      = link_to 'Roof Mount', '/products/roofmounting/overview'
      %span.carrot
      %ul#rm_sub_menu
        %li= link_to 'Overview', '/products/roofmounting/overview'
        %li= link_to '360 View', '/products/roofmounting/360view'
        %li= link_to 'Tech Specs', '/products/roofmounting/techspecs'
        %li= link_to 'Support', '/products/roofmounting/systemsupport'
        %li.configure_btn= link_to raw("#{config_icon} Configure"), '/rm'
        %li.quote_btn= link_to raw("#{config_quote} Get a Quote"), '/support/requestaquote'
    %li
      = link_to 'Ballasted Roof Mount', '/products/ballastedroofmounting/overview'
      %span.carrot
      %ul#brm_sub_menu
        %li= link_to 'Overview', '/products/ballastedroofmounting/overview'
        %li= link_to '360 View', '/products/ballastedroofmounting/360view'
        %li= link_to 'Tech Specs', '/products/ballastedroofmounting/techspecs'
        %li= link_to 'Support', '/products/ballastedroofmounting/systemsupport'
        %li.configure_btn= link_to raw("#{config_icon} Configure"), '/brm'
        %li.quote_btn= link_to raw("#{config_quote} Get a Quote"), '/support/requestaquote'
    %li
      = link_to 'Ground Mount', '/products/groundmounting/overview'
      %span.carrot
      %ul#gm_sub_menu
        %li= link_to 'Overview', '/products/groundmounting/overview'
        %li= link_to '360 View', '/products/groundmounting/360view'
        %li= link_to 'Tech Specs', '/products/groundmounting/techspecs'
        %li= link_to 'Support', '/products/groundmounting/systemsupport'
        %li.configure_btn= link_to raw("#{config_icon} Configure"), '/sga'
        %li.quote_btn= link_to raw("#{config_quote} Get a Quote"), '/support/requestaquote'
    %li
      = link_to 'Pole Mount', '/products/polemounting/overview'
      %span.carrot
      %ul#pm_sub_menu
        %li= link_to 'Overview', '/products/polemounting/overview'
        %li= link_to '360 View', '/products/polemounting/360view'
        %li= link_to 'Tech Specs', '/products/polemounting/techspecs'
        %li= link_to 'Support', '/products/polemounting/systemsupport'
        %li.configure_btn= link_to raw("#{config_icon} Configure"), '/pm'
        %li.quote_btn= link_to raw("#{config_quote} Get a Quote"), '/support/requestaquote'

見積もり依頼ページのコードはこちら

  <!-- container starts here -->
   <div id="container">

<br/>
<h1>GET A QUOTE</h1>
<div class="clear">&nbsp;</div>
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" name="form1" id="form1" method="POST" target="_parent">

<input type=hidden name="oid" value="00DU0000000I430">

<input type=hidden name="retURL" value="http://www.ironridge.com">


<div class="clear"></div>
<div id="footer_form" style="float:left">

<label>Product Type</label>
<select  id="00NU0000001hkz3" name="00NU0000001hkz3"  class="txt_field" title="Application Type"><option value="Roof Mount">Roof Mount</option>

<option value="Ballasted Roof Mount">Ballasted Roof Mount</option>

<option value="Ground Mount">Ground Mount</option>

<option value="Pole Mount">Pole Mount</option>

</select> <br/> <br/>

HAML と HTML を使用しています 事前にご意見をお寄せいただきありがとうございます

私が話していることの画像へのリンクは、多分それが役立つでしょう http://cmclove.org/Google%20Chrome1.png

4

2 に答える 2

0

私が考えることができる最も簡単な方法は、非常に基本的なクエリ文字列の実装です。したがって、ページAで、ユーザーがquotePage.htmlへのリンクをクリックしたら、quotePage.html?prod=BRMに送信します。次に、quotePage.htmlで、次の行に沿って何かを実行します。

$(document).ready(function(){
if(document.URL.indexOf("prod=BRM") !== -1){//if our url has our passed value
$('#00NU0000001hkz3 option:eq("Ballasted Roof Mount")').attr('selected', 'selected');
}
else
{
$('#00NU0000001hkz3 option:eq("Pole Mount")').attr('selected', 'selected');
}
});

(コードはテストされていませんが、一般的なロジックはあります)

于 2012-11-07T20:01:04.343 に答える
0

わかりました、元の回答であなたが望んでいたことを誤解したようです。jsfiddle の修正: http://jsfiddle.net/SxFtX/

HTML:

<a class="menuLink" href="">Menu 1</a>
<a class="menuLink" href="">Menu 2</a>
<a class="menuLink" href="">Menu 3</a>
<a class="menuLink" href="">Menu 4</a>

<select id="dd2" name="type1">
   <option value="1">Menu 1</option>
   <option value="2">Menu 2</option>
   <option value="2">Menu 3</option>
   <option value="2">Menu 4</option>
</select>

JS:

$('.menuLink').click(function() {
    var that = this;
    $('#dd2 option').each(function() {
        if (this.innerHTML === that.innerHTML) {
            $(this).attr('selected', 'selected')
        }
    });
});​
​
于 2012-11-08T15:02:14.730 に答える