|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Martyn Smarty n00b
Joined: 28 Apr 2003 Posts: 3
|
Posted: Mon Apr 28, 2003 12:05 pm Post subject: Does anyone know how I can insert a javascript function |
|
|
Hello,
I was building a page which contained a drop down menu.
I needed to insert a piece of Javascript to make sure that if the value changed the drop down menu changed it values.
I put this piece of javascript in a template file between the head tags, and then when I tried opening the page, the page was blank.
(indicating that it didn't work)
Does anyone know how I can make this page working?
thanks |
|
Back to top |
|
ciqala Smarty Rookie
Joined: 28 Apr 2003 Posts: 9
|
|
Back to top |
|
Martyn Smarty n00b
Joined: 28 Apr 2003 Posts: 3
|
Posted: Mon Apr 28, 2003 12:18 pm Post subject: |
|
|
{if ! $cat}
<select name='cat' onChange="MM_jumpMenu('parent',this,0)" cols='300'>
<option value='content.php?method=viewcomment'>Kies catogerie</option>
<option value='content.php?method=viewcomment&cat=algemeen#post'>Algemeen</option>
<option value='content.php?method=viewcomment&cat=news#post'>Nieuws</option>
<option value='content.php?method=viewcomment&cat=programma#post'>Programmas</option>
<option value='content.php?method=viewcomment&cat=apparatuur#post'>Apparatuur</option>
</select>
{/if}
And the piece of javascript is:
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script> |
|
Back to top |
|
Martyn Smarty n00b
Joined: 28 Apr 2003 Posts: 3
|
Posted: Mon Apr 28, 2003 12:23 pm Post subject: |
|
|
I've found it out Yeah.
You put the piece of javascript between literal tags
{literal} piece of javascript {/literal} |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|