daniish Posted October 6, 2006 Share Posted October 6, 2006 Hello,I am writing a form but am having difficulty getting two javascripts to run together. I can get both of them working on their own but not together (I'm using the latest Firefox browser)! The javascripts are:A wysiwyg text editorA textarea character counterYou can see my form here:[url=http://globexposure.net/openwysiwyg/add_blog_form4.html]http://globexposure.net/openwysiwyg/add_blog_form4.html[/url]I tried a second method also (it also doesn't work) which you can see here:[url=http://globexposure.net/openwysiwyg/add_blog_form2.html]http://globexposure.net/openwysiwyg/add_blog_form2.html[/url]Can anyone tell me why the textarea character counter does not work?Many thanksp.s. I posted on a different forum and only got 1 post which said the counter worked but not the WYSIWYG editor (on Safari browser). Link to comment https://forums.phpfreaks.com/topic/23159-cant-get-textarea-character-counter-to-work-with-other-javascripts/ Share on other sites More sharing options...
fenway Posted October 6, 2006 Share Posted October 6, 2006 Could you post just the revelant code snippets? Link to comment https://forums.phpfreaks.com/topic/23159-cant-get-textarea-character-counter-to-work-with-other-javascripts/#findComment-105001 Share on other sites More sharing options...
daniish Posted October 8, 2006 Author Share Posted October 8, 2006 I think it is easiest if i just give you the whole script. May i draw your attention to the 'Label Description:' which is where i am attempting to get both the WYSIWYG editor and character counter to work.[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE> Add Blog </TITLE> < script type="text/javascript" >/************************************************ Drop Down Date select script- by JavaScriptKit.com* This notice MUST stay intact for use* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more***********************************************/var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];function populatedropdown(dayfield, monthfield, yearfield){var today=new Date()var dayfield=document.getElementById(dayfield)var monthfield=document.getElementById(monthfield)var yearfield=document.getElementById(yearfield)for (var i=0; i<31; i++)dayfield.options[i]=new Option(i+1, i+1)dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's dayfor (var m=0; m<12; m++)monthfield.options[m]=new Option(monthtext[m], monthtext[m])monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's monthvar thisyear=today.getFullYear()for (var y=0; y<20; y++){yearfield.options[y]=new Option(thisyear, thisyear)thisyear+=1}yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year}</ script >< SCRIPT LANGUAGE="JavaScript" ><!-- Begin var submitcount=0; function checkSubmit() { if (submitcount == 0) { submitcount++; document.add_blog.submit(); } }function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) {field.value = field.value.substring(0, maxlimit);} else {countfield.value = maxlimit - field.value.length;} }// End --></ script ></HEAD>< script language="JavaScript" type="text/javascript" src="wysiwyg.js" ></ script > <BODY>So you've just visited some place new and exciting...well blog those experiences right here. <br> The 'Travel Blog' & 'Associated Link' are not mandatory.<br><br>< script language="JavaScript" type="text/javascript" src="wysiwyg.js" ></ script > <form name=add_blog action="insert.php" method="post">Title: <br><input type="text" size="79" id="title" method="post" name="title"></input> <br><br>Date: <br><select id="daydropdown"></select> <select id="monthdropdown"></select> <select id="yeardropdown"></select> <br><br>Label Description: <br><textarea rows="5" cols="100" id="description" name="description" onKeyDown="textCounter(this.form.description,this.form.remLentext,255);" onKeyUp="textCounter(this.form.description,this.form.remLentext,255);"></textarea> < script language="JavaScript1.2">generate_wysiwyg('description');</ script ><br>Characters remaining: <input type=box readonly name=remLentext size=3 value=255 /><br><br>Travel Blog: <br><textarea rows="25" cols="100" id="blog" name="blog"></textarea> < script language="JavaScript1.2" >generate_wysiwyg('blog');</ script > <br><br>Latitude: <br><input type="text" size="7" id="lat" name="lat"></input> <br><br>Longitude: <br><input type="text" size="7" id="lon" name="lon"></input> <br><br>Associated Link: <br><textarea rows="10" cols="100" id="link" name="link"></textarea> < script language="JavaScript1.2" >generate_wysiwyg('link');</ script > <br><br>Marker: <br><input type="text" size="10" id="marker" name="marker"></input> <br><br><INPUT TYPE="button" VALUE="Submit" onclick='' name="submit" /></form>< script type="text/javascript" >//populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select)window.onload=function(){populatedropdown("daydropdown", "monthdropdown", "yeardropdown")}</ script ></BODY></HTML>[/code]Many thanks - i hope you can see a solution! Link to comment https://forums.phpfreaks.com/topic/23159-cant-get-textarea-character-counter-to-work-with-other-javascripts/#findComment-105956 Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 Maybe it's easier for you, but I don't have time to wade though all that code.Are you sure that your textCounter function is being called? Link to comment https://forums.phpfreaks.com/topic/23159-cant-get-textarea-character-counter-to-work-with-other-javascripts/#findComment-106921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.