Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

iframe change params.


Hi,

A friend asked me if i could help him building a lilttle website.

Having 10 years of proffessional experiance in writing "non-webbased" code i
thought that will not be that hard.
I think here it went wrong.

The only thing he want to do is integrating an external provided iframe into
his website and make that multilingual using some little flags that he puts
at the top of his site.

This is the src iframe src="provideroftheframe.php?lang=en"

So when he clicks for example a spanish flag the param lang should change to
ES , the france flag to FR...

Is this possible using a javascript and if so can someone provide me a
solution ; this has to be done without server side technologie

Kind regards

J.

On May 19, 12:19 pm, "Jo Claes" <jcl@skynet.be> wrote:

> This is the src iframe src="provideroftheframe.php?lang=en"

> So when he clicks for example a spanish flag the param lang should change to
> ES , the france flag to FR...

You don't need any Javascript for that, plain old HTML will suffice:

<iframe name="MyIFrame" src="provideroftheframe.php?lang=en">

<a href="provideroftheframe.php?lang=es" target="MyIFrame"><img
src="Spain.gif"></a>

Hi,

and what if you have two params fe.
provideroftheframe.php?lang=en&category=1
clicking flag will change the language and a dropdown list using the
category ?

Kind regards

"VK" <schools_r@yahoo.com> wrote in message

news:1179563738.249209.50530@q75g2000hsh.googlegroups.com...

On May 19, 1:07 pm, "Jo Claes" <jcl@skynet.be> wrote:

> Hi,

> and what if you have two params fe.
> provideroftheframe.php?lang=en&category=1
> clicking flag will change the language and a dropdown list using the
> category ?

Then you have a different solution, obviously. The previous one has
been given for what you asked in the original post.

For more complicated situations you have to decide if:
a) all possible URL parameters can be stored in form controls.
b) URL parameters cannot be hardcoded but must be calculated client-
side depending on user input.

In case a) you still don't need any Javascript:

<iframe name="MyIFRAME" src="provideroftheframe.php?lang=en">

<form target="MyIFRAME" method="GET" action="provideroftheframe.php">
<input type="text" name="lang" value="es">
<input type="text" name="category" value="1">
<input type="submit">
</form>

Obviously you can use any needed control types, text boxes are used
only for simplicity.

In case b) you need to query form controls for current values,
validate the input, make the needed calculations based on it, generate
URL string and assign iframe's window.href property to get new page.
An abstract description of all these operations would be effectively
equal to a set of posts with Javascript introductory lessons; thus if
the variant b) is your case then please post the entire page your are
working with with the exact explanation what form controls  do you
want to use for URL generation and by what algorithm. A demonstration
of your initial attempt to solve the problem - even if failed - would
be also much appreciated.

Jo Claes a crit :

> The only thing he want to do is integrating an external provided iframe into
> his website and make that multilingual using some little flags that he puts
> at the top of his site.

<a href="myPage.html.en" target="myIframe">
   <img src="en_flag.jpg" alt="english" title="english">
</a>
<a href="myPage.html.sp" target="myIframe">
   <img src="sp_flag.jpg" alt="spanish" title="spanish">
</a>
<a href="myPage.html.fr" target="myIframe">
   <img src="fr_flag.jpg" alt="french" title="french">
</a>

> This is the src iframe src="provideroftheframe.php?lang=en"

> So when he clicks for example a spanish flag the param lang should change to
> ES , the france flag to FR...
> Is this possible using a javascript and if so can someone provide me a
> solution ; this has to be done without server side technologie

If really he uses php and variable to set language
and absolutly wants to be dependent of JS :

function country(flag) {
document.myIframe.location.href = 'provideroftheframe.php?lang='+flag;

}

<img src="en_flag.jpg" alt="english" onclick="country('en');">
<img src="sp_flag.jpg" alt="spanish" onclick="country('sp');">
<img src="fr_flag.jpg" alt="french"  onclick="country('fr');>

or (better) :

function country(flag) {
document.myIframe.location.href = 'provideroftheframe.php?lang='+flag;
return false;

}

<a href="myPage.html.en" target="myIframe"
    onclick="return country('en');">
   <img src="en_flag.jpg" alt="english" title="english">
</a>
<a href="myPage.html.sp" target="myIframe"
    onclick="return country('sp');">
   <img src="sp_flag.jpg" alt="spanish" title="spanish">
</a>
<a href="myPage.html.fr" target="myIframe"
    onclick="return country('fr');">
   <img src="fr_flag.jpg" alt="french" title="french">
</a>

--
Stephane Moriaux et son (moins) vieux Mac dj dpass
Stephane Moriaux and his (less) old Mac already out of date

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc