Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Does anyone know how I can insert a javascript function

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Martyn
Smarty n00b


Joined: 28 Apr 2003
Posts: 3

PostPosted: Mon Apr 28, 2003 12:05 pm    Post subject: Does anyone know how I can insert a javascript function Reply with quote

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
View user's profile Send private message
ciqala
Smarty Rookie


Joined: 28 Apr 2003
Posts: 9

PostPosted: Mon Apr 28, 2003 12:13 pm    Post subject: Reply with quote

i'm working on the exact same thing right now as part of a page class to create standard objects for each page.

post the template code you are using, its just possible you might have missed something in the html.


Last edited by ciqala on Wed May 05, 2010 10:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
Martyn
Smarty n00b


Joined: 28 Apr 2003
Posts: 3

PostPosted: Mon Apr 28, 2003 12:18 pm    Post subject: Reply with quote

{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
View user's profile Send private message
Martyn
Smarty n00b


Joined: 28 Apr 2003
Posts: 3

PostPosted: Mon Apr 28, 2003 12:23 pm    Post subject: Reply with quote

I've found it out Yeah.

You put the piece of javascript between literal tags
{literal} piece of javascript {/literal}
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP