SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    moving to here.cfm and there.cfm by selection

    The code below doesn't work correctly. but I made it for explaining what I want.
    Code:
    <form action='action.htm' target='_blank'>
    
    <select>
    <option value=action>action.htm</option>
    <option value=here>here.htm</option>
    <option value=there>there.htm</option>
    </select>
    
    <input type='submit'>
    
    </form>
    I like to make it like the following.

    If a user selects action.htm and click the submit button, it goest to action.htm.

    If a user selects here.htm and click the submit button, it goest to here.htm.

    If a user selects there.htm and click the submit button, it goest to there.htm.


    Is it possible?

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does this help man?
    Code:
    <script language="javascript">
    function frmLoad(fm){
    	fm.target = '_blank';
    	fm.method = 'get';
    	fm.action = fm.select_page.value + '.htm';
    	fm.submit();
    }
    </script>
    <form name="frmsubmit" onSubmit="return frmLoad(this);">
    <select name="select_page">
    	<option value='action'>action.htm</option>
    	<option value='here'>here.htm</option>
    	<option value='there'>there.htm</option>
    </select>
    <input type='submit' value="Submit" name="submit">
    </form>
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,116
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Hi,

    Here's the default dreamweaver jump menu.

    Code JavaScript:
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    }

    Code HTML4Strict:
    <form action='action.php' target='_blank'>
        <select name="action" onchange="MM_jumpMenu('parent',this,0)">
          <option value="action.htm">action</option>
          <option value="here.htm">here</option>
          <option value="there.htm">there</option>
        </select>
    	<input type="submit" />
    </form>

    For a fallback make the page that is in the forms action attribute pick up the value and redirect server side.

  4. #4
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you, rajug and markbrown4. Both works fine.

  5. #5
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I have another question on this.

    Look at the following code which rajug suggested.

    Code:
    <script language="javascript">
    function frmLoad(fm){
    	fm.target = '_blank';
    	fm.method = 'get';
    	fm.action = fm.select_page.value + '.htm';
    	fm.submit();
    }
    </script>
    <form name="frmsubmit" onSubmit="return frmLoad(this);">
    <select name="select_page">
    	<option value='action'>action.htm</option>
    	<option value='here'>here.htm</option>
    	<option value='there'>there.htm</option>
    </select>
    <input type='submit' value="Submit" name="submit">
    </form>
    It will go to action.htm, here.htm, or there.htm with a new browser .

    I like to make it go to action or here.htm with a new brower or go to there with the same browser.

  6. #6
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,116
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    It will go to action.htm, here.htm, or there.htm with a new browser .

    I like to make it go to action or here.htm with a new brower or go to there with the same browser.
    I don't understand.

  7. #7
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    I don't understand.
    Sorry for my poor English.

    The following would-be code doesn't work correctly, but it will show what I want.
    Code:
    would-be code
    
    <script language="javascript">
    function frmLoad(fm){
    	fm.method = 'get';
    	fm.action = fm.select_page.value + '.htm';
    	fm.submit();
    }
    </script>
    <form name="frmsubmit" onSubmit="return frmLoad(this);">
    <select name="select_page">
    	<option value='action' target='_blank'>action.htm</option>
    	<option value='here' target='_blank'>here.htm</option>
    	<option value='there'>there.htm</option>
    </select>
    <input type='submit' value="Submit" name="submit">
    </form>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •