Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: DHTML window - user defined

  1. #1
    Join Date
    Apr 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML window - user defined

    Hi, Please take a look at this url

    http://www.dynamicdrive.com/dynamici...htmlwindow.htm

    I want to load (in place of google), a user defined url in the form of ....

    Code:
    <a href="javascript:loadwindow('http://finance.google.com/finance?q=VARIABLE&btnG=Search',800,600)">Click Here</a>
    See where it says VARIABLE, I want that text to be replaced with user input and then output the webpage.

    Any idea. Please take some time out if you have some idea. Thank you.

    I know how to take the input from html form but not sure how I will define the variable.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    How do you want to get input? Through a text box?
    Code:
    <input type="text" id="url">
    <a href="javascript:loadwindow('http://finance.google.com/finance?q='+document.getElementById('url').value+'&btnG=Search',800,600)">Click Here</a>
    Through a popup?
    Code:
    <a href="javascript:loadwindow('http://finance.google.com/finance?q='+window.prompt('Please enter your search terms:') + '&btnG=Search',800,600)">Click Here</a>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Apr 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey thank you for you reply, you understood what I wanted to do. I wanted to do the first one....So basically this is my form

    Code:
    <FORM METHOD="get" ACTION="userinputcompany.php">
    <INPUT TYPE=hidden NAME=choice VALUE=request>
    
    Type in your symbol(like: BBY)
    <INPUT TYPE="text" SIZE="20" NAME="search" Value="">
    <INPUT TYPE="submit" VALUE="Search!">
    </FORM>
    So basically I want "search" variable to be in the url.

    I tried what u said, but it seems after submitting my text and then clicking on Here, the main finance google comes up, not the url I defined.

    Your reply is well appreciated.

    P.s. You second method work flawlessly but I don't want pop up window text. Thanks
    sorry your first method also works.. you my friend are a genius... (i was wondering about the submit button)..... but I really need to know how I can do this via the above form because I am doing other php functions as well with that user input.

    thanks..
    Last edited by orphy; 04-09-2006 at 10:42 PM.

  4. #4
    Join Date
    Apr 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok Twey, I went with your first one... but how do you keep the userinput text after he clicks submits.....

    So basically... he types "bby" clicks submits.... "bby" will still be in the text field.

    I think it will work then...

    this is what i did

    Code:
    <FORM METHOD="get" ACTION="userinputcompany.php">
    <INPUT TYPE=hidden NAME=choice VALUE=request>
    
    Type in your symbol(like:bby)
    <INPUT TYPE="text" SIZE="20" id="url" NAME="search" Value="">
    <INPUT TYPE="submit" VALUE="Search!">
    </FORM>
    I put your id="url" in that form. It works as long as I type the text in the field and instead of clicking submit, I click "here" for the google page. But if i click submit, text disappears and google page doesn't work anymore.

    So
    1)how do I keep the text in field even after I click submit
    Or
    2) Another "better" idea

    Thanks, these things are relatively new to me... so please be considerate. thanks

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    2) Another "better" idea
    Yes, actually. Drop the Javascript and open a real window:
    Code:
    <form method="get" action="http://finance.google.com/finance" target="_blank">
      <input type="hidden" name="btnG" value="Search">
      <input type="text" name="q">
      <input type="submit" value="Search!">
    </form>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Apr 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Dear Twey, that is actually a very clever use of html. But I would like to embedd the google page in my site or atleast have it like the "dtmlwindow" program from this site.

    The main problem here is I don't want another search field. I already have a search field (the one I posted in previous post). I have a bunch of program being executed taking the user input from that field.

    Now, I want to execute this javascript using the input from original text field without making another one.

    Your response is very much appreciated.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    But I would like to embedd the google page in my site or atleast have it like the "dtmlwindow" program from this site.
    In that case, use an iframe:
    Code:
    <form method="get" action="http://finance.google.com/finance" target="searchwin">
      <input type="hidden" name="btnG" value="Search">
      <input type="text" name="q">
      <input type="submit" value="Search!">
    </form>
    <iframe name="searchwin"></iframe>
    It can be embellished to make it into a DHTML window where supported once we're resolved the more serious problem:
    I have a bunch of program being executed taking the user input from that field.
    The real question here is, how many? It's definitely worth editing a few programs to avoid Javascript dependence on your site.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Apr 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    great. I love iframe.

    How do I define the area of my iframe?

    Also is it possible to load that url via php in iframe?

    loading this: http://finance.google.com/finance?q=$search&btnG=Search

    where $search is the user input variable?

    that will solve all my problems and get rid javascripts as well.

  9. #9
    Join Date
    Apr 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok I now I know how to define the area ... did a simple google search.

    Also is there a way to hide the frame before a user actually submits their text?

    still looking for php answer.

    thanks...you my friend are not only smart but very helpful..


    Edited:
    Alright... I now see that iframe's design and placement can be manipulated.... I can't seem to find a way to get rid of the iframe scroll and still have the full document... letting my original browser scroll to navigate the iframe content.
    Last edited by orphy; 04-11-2006 at 01:57 PM.

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Also is it possible to load that url via php in iframe?

    loading this: http://finance.google.com/finance?q=$search&btnG=Search

    where $search is the user input variable?
    Assuming $search is defined on that page, the usual:
    Code:
    <iframe src="http://finance.google.com/finance?q=<?php echo($search); ?>&amp;btnG=Search
    should work fine.
    Alright... I now see that iframe's design and placement can be manipulated.... I can't seem to find a way to get rid of the iframe scroll and still have the full document... letting my original browser scroll to navigate the iframe content.
    Not sure what you mean here. You want the main scrollbars at the side of the browser window to control the scrolling of the content in the iframe?
    Also is there a way to hide the frame before a user actually submits their text?
    Of course. There are two ways to do this: the visibility property, or the display property. Setting visibility:hidden on the iframe will make it not display, but the rest of the page will behave as if it were still there. Setting display:none will remove it completely.
    Code:
    <form method="get" action="http://finance.google.com/finance" target="searchwin" onsubmit="showiframe(document.frames['searchwin']);">
      <input type="hidden" name="btnG" value="Search">
      <input type="text" name="q">
      <input type="submit" value="Search!">
    </form>
    <iframe name="searchwin"></iframe>
    <script type="text/javascript">
    // Set the original values with Javascript, so non-JS browsers see it displayed from the start
    (
      var showiframe = function(frame) {
        var property = "display"; // Change to "visibility" if this mucks up your layout
        if(typeof arguments[1] != "undefined") frame.style[property] = (property == "visibility" ? "hidden" : "none");
        else frame.style[property] = (property == "visibility" ? "visible" : "block");
      }
    )(document.frames['searchwin'], true);
    </script>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •