[greenstone-users] Problem with Javascript

From Qiu
DateMon Dec 17 16:58:50 2007
Subject [greenstone-users] Problem with Javascript
In-Reply-To (d2dbf2f40712140752t2cffafddwe89617a6f06a98ee-mail-gmail-com)
Hi Ra□l

Which page do you want to put javascript on? For example, if you want to
have the drop down list on the home page, a _pagescriptextra_ macro
needs to be inserted into "package home" of the home.dm file. And it
will be like:

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

Also, add codes below to the _content_ macro of "package home" of the
home.dm file.
<td width="306" valign="top"><form name="form1" id="form1">
<select name="otras_opciones"
onchange="MM_jumpMenu('parent',this,1)">
<option>Otras opciones</option>
<option value="http://www.link.cl">Opcion1</option>
<option value="http://www.link.cl">Opcion2</option>
<option value="http://www.link.cl">Opcion3</option>
</select>
</form>
</td>

Regards
Quan

Ra□l Barrera wrote:
> Hi, I need help in doing a JumpMenu.
> If I use it within a ordinary html page it works geat, but within
> Greenstone I have the following problem.
> In html I've inserted a javasript function in the <head>, the script
> is this:
>
> <script type="text/JavaScript">
> <!--
> function MM_jumpMenu(targ,selObj,restore){ //v3.0
>
> eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
> if (restore) selObj.selectedIndex=0;
> }
> //-->
> </script>
>
> And after a call it from the body in the web page in this way:
>
> <td width="306" valign="top"><form name="form1" id="form1">
> <select name="otras_opciones"
> onchange="MM_jumpMenu('parent',this,1)">
> <option>Otras opciones</option>
> <option value="http://www.link.cl">Opcion1</option>
> <option value="http://www.link.cl">Opcion2</option>
> <option value="http://www.link.cl">Opcion3</option>
> </select>
> </form>
> </td>
> Everything works fine, but in Greenstone the script is ignored, I
> inserted in the _pagescriptextra_ macro in the style.dm
> <http://style.dm> macro package, but don't work.
> How can I do this? where can I put the script code to use it? what
> have I done wrong?
>
> Please help me, thank you.
> --
> Ra□l Barrera P.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> greenstone-users mailing list
> greenstone-users@list.scms.waikato.ac.nz
> https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-users
>