PDA

View Full Version : DHTML window - user defined



orphy
04-08-2006, 10:59 PM
Hi, Please take a look at this url

http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow.htm

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



<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.

Twey
04-08-2006, 11:28 PM
How do you want to get input? Through a text box?
<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?
<a href="javascript:loadwindow('http://finance.google.com/finance?q='+window.prompt('Please enter your search terms:') + '&btnG=Search',800,600)">Click Here</a>

orphy
04-09-2006, 09:30 PM
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



<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..

orphy
04-09-2006, 10:02 PM
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




<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

Twey
04-10-2006, 12:11 AM
2) Another "better" ideaYes, actually. Drop the Javascript and open a real window:
<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>

orphy
04-10-2006, 01:29 AM
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.

Twey
04-10-2006, 05:56 PM
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:
<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.

orphy
04-11-2006, 11:59 AM
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.

orphy
04-11-2006, 12:05 PM
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.

Twey
04-11-2006, 04:23 PM
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:
<iframe src="http://finance.google.com/finance?q=<?php echo($search); ?>&amp;btnG=Searchshould 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.
<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>

orphy
04-12-2006, 03:18 AM
Assuming $search is defined on that page, the usual:
<iframe src="http://finance.google.com/finance?q=<?php echo($search); ?>&amp;btnG=Searchshould work fine.

THANK YOU!! It's funny how this simple line is what I actually wanted from the start. Works great now!! Now I have to know everything about iframe. Got hooked :D



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?
Yes... It may not be easy I think.

I couldn't work the javascript that you wrote but for now, I actually got what I wanted.

Here it is: I know it's messy, I need to learn CSS now to fix it I suppose:

http://www.streetrobber.com/learning/userinputcompany.php

So basically you see how google page has a scroller, I wanted to get rid off that and scroll those content via the browser scroller..as I intend to place the google page all way in the bottom.

I think this may be complicated. Dynamic drive actually have a script to do this but it doesn't recognize documetns outside your own domain.