JavaScript - Trying To Apply Selected Attribute To Current Select Box Item
Hiya!
I'm a total JS beginner, so any help is appreciated. I've created the simple select box below that will "onchange" when an item is selected. I'm trying to apply the "selected" or "selected="selected" attribute to items that are chosen from the menu. Example: The goal is to show " <option value="/1" selected="selected"> " when page "/1" is chosen and to show <option value="/1"> when /1 is not the current page. I've follow a few simple tutorials with no luck and even tried php conditionals to trigger the "selected" attribute with no luck. Any feedback is GREATLY appreciated, thank you! Code: <form name="guideform" method="get"> <select class="wptdb_jumpbar_select" name="mymenu" onChange="window.location=document.guideform.mymenu.options[document.guideform.mymenu.selectedIndex].value"> <option value="/1">Home Page #1</option> <option value="/2">Home Page #2</option> <option value="/3">Home Page #3</option> <option value="/4">Home Page #4</option> </select> </form> Similar TutorialsHello all, I am having a problem, and since I am quite new in the Javascript code I hope somebody can help me here. This is my current code: Code: <select class="Form" name="opties"> <option value="AAA">AAA</option> <option value="BBB">BBB</option> <option value="SLX" selected>Selecteer optie</option> </select> Now my intention is the following: When the option with value SLX gets selected it needs to get a special css style. It is not a problem to give the option this style in the list itself, but once selected it always changes to the original style (standard font and color) in Chrome and Mozilla. Now I searched on the net and sometimes I find things like this: Code: function displayOption(divName) { document.getElementById(divName).innerText=document.form1.select1.options[document.form1.select1.selectedIndex].value; } <select class="Form" name="opties" onChange="displayOption('div1');"> <option value="AAA">AAA</option> <option value="BBB">BBB</option> <option value="SLX" selected>Selecteer optie</option> </select> But I suppose this always changes the style of the selected item? It only needs to change when the option SLX is chosen... Anyone knows how to solve this problem? Hi, I currently have a script that dynamically adds a css class called "on" to a menu item once it is selected, turning that link red to show that it's active. Here is the web page: www.talmagecooley.com/films.html As you can see, if you click on "Dimmer" or "Pol Pot's Birthday", or one of the three Patriotville scene links (1, 2, or 3), those links stay red. But what I need to happen is that when the user hovers over OR clicks on "1", "2", or "3", the word "Patriotville" also turns red along with those links. Here is the current code: <script language="JavaScript" type="text/javascript"> /*<![CDATA[*/ var Lst; function CngClass(obj){ if (Lst) Lst.className=''; obj.className='on'; Lst=obj; } /*]]>*/ </script> <li class="rss-popup" id="patriotville"><a id="three" href="#" onclick="" class="feed-link" style="color:#fff;">PATRIOTVILLE</a></li> <div id="clips"> <li class="rss-popup"><a id="four" href="#" onclick="changeIt('film3_1');CngClass(this);">1</a></li> <li class="rss-popup"><a id="five" href="#" onclick="changeIt('film3_2');CngClass(this);">2</a>|</li> <li class="rss-popup"><a id="six" href="#" onclick="changeIt('film3_3');CngClass(this);">3</a></li> </div> ********** Any help would be greatly appreciated! Thanks!! Hi All. I have a dropdown list on a web form containing dates. My Question: How can I call data for that selected item(date) from a MySQL database and display it to the user? And more specifically, if that selected date has no data in the data base, I want to be able to display that as well. I'm looking for a Javascript solution, and if possible a php solution. Thank You! Hello, I am hoping someone can help me with following search form. As you can see I have created a form but I don't know how to fix the coding so when a user select a category it will add a different hidden filed for that option for example: When the user selects category "Men" the hidden filed Code: <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://men.com/acatalog/"> will be added and when the user selects category "Kids" the hidden filed Code: <INPUT TYPE="HIDDEN" NAME="REFERRER" VALUE="http://kids.com/acatalog/"> will be added and so on... Here is my form coding I am using: Code: <form name="simplesearch" method="get" action="" onsubmit="ssite=document.getElementById('sitelist');this.action=ssite.options[ssite.selectedIndex].value;return true;"> <input type="hidden" name="page" value="search" /> <input type="hidden" name="PR" value="-1" /> <input type="hidden" name="TB" value="A" /> <input type="hidden" name="NOLOGIN" value="1" /><input align="top" class="main_search_box" name="SS" type="text" value="search for ..." onfocus="this.value='';"> Search within: <select id="sitelist"> <option value="">Select Catagory</option> <option value="http://kids.com/cgi-bin/ss000001.pl">kids</option> <option value="http://men.com/cgi-bin/ss000001.pl">men</option> <option value="http://women.com/cgi-bin/ss000001.pl">women</option> </select><input type="submit" class="button" name="ACTION" value="Go!"> </form> Also I have one more question how do I make the "Select Catagory" a Must Choose and if not chosen to give message that say"Please Select a Category" Thank you in advance for any help you can give me... I am a bigginer so please go easy on me -------------------------------------------------------------------------------- Can some1 help me at this, i am very new to javsciprt and HTML things, so as the title says, a simple bold to the selected text in a div is what i need. below is the div area i have, so how do it?? Code: <TD colspan="25" width="525px" style="text-overflow: ellipsis; overflow: hidden;"> <input type="hidden" $acmForms.bindText("casecomments") /> <div #if (!$acmForms.getFormAttributes().isReadOnly()) CONTENTEDITABLE #end onKeyUp="dairy_limitTextArea(this, 4000)" onKeyDown="dairy_limitTextArea(this, 4000)" id="spell_casecomments" style="width:800px; height:220px; overflow: auto; border: 1px solid #bdcee5;"> </TD> what can be the reasons for the same code which works perfectly in notepad to not show its result in a jsp application done using eclipse??anything to do with settings? I am not able to display the current date as default in dd/mm/yyyy format in drop down boxes..only dd and yyyy apears but month isnt apearing as default.. can u suggest alternative logic and its code to implement the same?? Ok so let's say I have this dropdown with a list of these items: PALCO TRIBUNA ORO And in a button on the page I want to send it one of those names, let's say I send it ORO, and through Javascript select that in the dropdown list. How is this done? Do I have to iterate through everything, and how? Thanks for any help in the subject. If i have a drop down list on my website, and i want to use javascript to change its selected value, however, i do not have the id/name attribute of the option i want to select, only have the "value" attribute of the option, can it be done? <select name="category"> <option value="">No Preference</option> <option value="Apples">Apples</option> <option value="Oranges">Oranges</option> <option value="Pears">Pears</option> <option value="Banana">Banana</option> </select> I imagine somehow.. selecting the options and looping through them and match the value. Really new to javascript, can anyone advise? Thanks in advance! I currently have two html select list boxes side by side on a form, two buttons in between the boxes to move items from list box to the other, and a javascript function to control the movement of the items from one box to the other. Here is the javascript: Code: function MoveSelected(from, to) { var lstFrom = $(from); var lstTo = $(to); for (var i = 0; i<lstFrom.length;i++) { if ( lstFrom[i].selected ) { var elOptNew = document.createElement('option'); elOptNew.text = lstFrom[i].text; elOptNew.value = lstFrom[i].value; try { lstTo.add(elOptNew, null); // standards compliant; doesn't work in IE } catch(ex) { lstTo.add(elOptNew); // IE only } } } for (var i = lstFrom.length-1; i>=0;i--) { if ( lstFrom[i].selected ) { lstFrom.options[i] = null; } } } Here are the two html form select list boxes (lstAvailProd is the starting list box that lists the initial data and lstSelectProd is the destination list box): Code: <td width="10%" valign="center"> <a href="javascript: MoveSelected('lstAvailProd','lstSelectProd');"><IMG SRC="buttons/right_arrow.gif" style="padding-bottom: 2px;" /></a><br /><br /> <a href="javascript: MoveSelected('lstSelectProd','lstAvailProd');"><IMG SRC="buttons/left_arrow.gif" /></a> </td> I was wondering if anyone could tell me how I could modify my code to allow for the selection of all the data in the starting list box by only selecting and moving the first item in the list to the destination list box? The first item is called "All Products", so instead of actually selecting every product in the starting list and moving them to the destination list, I would like the code to see that if the "All Products" list item is moved to the destination list, move all the other list items in the destination list back to the starting list. Here's an example of what the code for each list box looks like: Starting List Box: Code: <select name="lstAvailProd" id="lstAvailProd" multiple="true" size="8" style="width: 250px;"> <option value="-1">{All Products}</option> <option value="1">Product 1</option> <option value="2">Product 2</option> <option value="3">Product 3</option> <option value="4">Product 4</option> <option value="5">Product 5</option> </select> Destination List Box: Code: <select name="lstSelectProd" id="lstSelectProd" multiple="true" size="8" style="width: 250px;"> </select> Any help would be appreciated, thanks!! When first loading the page, I want the default select box value to be showing, and change when they select a different value. It works perfect when I select any value, but it's blank on load. I've attached screenshots showing. How can I get it default selected to show "Please Select a Character Class to view more information." Code: <script type = "text/javascript"> function showDetails(which) { var d = document.getElementById("classDescription"); var s = which.value; if (s == "Enchantress") {d.innerHTML = "<b>Enchantress</b><br />This character is a magic user. You are weak with attacks, but powerful with magic."} if (s == "Knight") {d.innerHTML = "<b>Knight</b><br />This character is a physical user. You are powerful with attacks, but weak against magic."} if (s == "Archer") {d.innerHTML = "<b>Archer</b><br />This character is a unique user. You can attack twice, but can't equip shields."} if (s == "Thief") {d.innerHTML = "<b>Thief</b><br />This character lurks in the shadows. He is crafty, weak attacks, decent magic."} if (s == "") {d.innerHTML = "Please Select a Character Class to view more information."} } </script> Code: <select name="Character_Class" id="CharClass" onchange="showDetails(this)"> <option value="" selected="selected">Choose a Class</option> <option value="Enchantress">Enchantress</option> <option value="Knight">Knight</option> <option value="Archer">Archer</option> <option value="Thief">Thief</option> </select> Code: <li><div id="classDescription"></div></li> Hello, I have this reservation form found on the main page of: http://www.avis.com.lb/ As you can see the current month "August" is selected as the default month and so is the year and day (the day is programmed to jump 2 days ahead for the renting of the car...) However if you look closely (check the screenshot attached) you'll see that the month "August" is repeated twice and so is the year "2009", the current month is repeated twice. What I wanna do is remove the duplication and just auto select the current month without duplicating it. I found this code: http://www.experts-exchange.com/Prog..._24229186.html But it doesn't seem to work with my form, I donno why. Here is the code of the script both javascript and a little bit of php PHP Code: $date = strtotime("+2 day"); $date2 = date('j',$date); $date4 = strtotime("+5 day"); $date3 = date('j',$date4); if($date3 == 1){ $nextmonth = strtotime("+1 day"); $monthid = date('m',$nextmonth); }else{ $nextmonth = strtotime("+0 day"); $monthid = date('m',$nextmonth); } if ($monthid==1){ $year = date("Y") + 1; }else{ $year = date("Y"); } //$pupday = date("j") - 12; //$pupday = date("d") + 2; //echo $pupday; //$returnday = date("d") +5; $month = date("F"); Code: var xMonths = new Array( '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12' ); function getListValue( option_object ){return option_object[ option_object.selectedIndex ].value;} function setListValue( option_object, value ){ option_object.selectedIndex = value;} function addDays(myDate,days) { return new Date(myDate.getTime() + days*24*60*60*1000); } function init() { xToday = new Date(); yToday = addDays(new Date(),3); xMonth = xToday.getMonth(); xDay = xToday.getDate()-1; xYear = xToday.getYear()-2005; if (xYear < 2005) xYear=0; yMonth = yToday.getMonth(); yDay = yToday.getDate()-1; yYear = yToday.getYear()-2005; if (yYear < 2005) yYear=0; xF = document.forms['quickbooking']; setListValue( xF.ETAHour, 9 ) setListValue( xF.ETAMonth, xMonth ) setListValue( xF.ETADay, xDay ) setListValue( xF.ETAYear, xYear ) setListValue( xF.ETTHour, 9 ) setListValue( xF.ETTMonth, yMonth ) setListValue( xF.ETTDay, yDay ) setListValue( xF.ETTYear, yYear ) } Code: <select class="formField" name="ETAMonth"> <option value="<? echo $monthid; ?>" selected="selected"><? echo $month; ?></option> <option value="01">January</option> <option value="02">February</option> <option value="03">March</option> <option value="04">April</option> <option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select class="formField" name="ETAYear"> <option value="<? echo $year; ?>" selected="selected"><? echo $year; ?></option> <option value="2008">2008</option> <option value="2009">2009</option> <option value="2010">2010</option> </select> Help is very appreciated, thanks. ok so i need help.... I need to create a page containing five image tags, two buttons, a <select> and a <textarea>. The images tags will each contain a picture of one of six possible outcomes for the dice portraying the numbers one through six.. The first button: When the user clicks on the button, all dice are rolled once. For each die when rolled, the src of its image tag is replaced with a random one of six possible pictures -- each picture being chosen with equal probability (1/6).... I HAVE THIS DONE The select: The user may select any of the numbers one through six. Whenever a picture is clicked upon, then that die takes on the value shown inside the <select>..... THIS IS WHAT I NEED HELP WITH The textarea: Results of the dice rolls should be kept as a running log (a cumulative history) in a textarea at the bottom of the page. With each roll (initiated by the click of the button), we should be able to see the complete history of all current and previous dice rolls. You need not consider changes brought about clicks on individual dice in conjunction with the <select>....I HAVE THIS DONE The second button: A button below the textarea, should allow the user to obtain a report (overwriting the current contents of the log in the textarea) which tabulates the frequency of each of the six outcomes plotted separately for each of the dice. The frequency tabulation should show how often each die was rolled, as consistent with the data stored in the log.... I HAVENT EVEN GOTTEN AROUND TO WORRYING ABOUT THIS YET This is what i have so far and have so far exhausted everything that i know to try to get it to work but this is just the code with out any of my failed attempts dragged into it <head> <style> input{background-color:#B0D0BC;text-align:center} </style> <script> order=["c_01.jpg"] function roll(){ {r=Math.ceil(Math.random()*5) document.images[0].src="c_0"+r+".jpg" t.value=t.value+"\n"+r} {r=Math.ceil(Math.random()*5) document.images[1].src="c_0"+r+".jpg" t.value=t.value+" "+r} {r=Math.ceil(Math.random()*5) document.images[2].src="c_0"+r+".jpg" t.value=t.value+" "+r} {r=Math.ceil(Math.random()*5) document.images[3].src="c_0"+r+".jpg" t.value=t.value+" "+r} {r=Math.ceil(Math.random()*5) document.images[4].src="c_0"+r+".jpg" t.value=t.value+" "+r} } function swap(n){ remember=document.images[n].src= document.images[n].src="c_01.jpg" remember=order[n] } </script> <div align="center"><center><table border="4" cellpadding="5" bgcolor="#E0E0DC"> <tr> <td> <img src="c_01.jpg" alt="100" onclick="swap(0)"></td> <td> <img src="c_02.jpg" alt="100" onclick="swap(1)"></td> <td> <img src="c_03.jpg" alt="100" onclick="swap(2)"></td> <td> <img src="c_04.jpg" alt="100" onclick="swap(3)"></td> <td> <img src="c_05.jpg" alt="100" onclick="swap(4)"></td> </tr> <tr> <td colspan="5" align="center"> Select A Value: <select name="hi"> <option value="hi1" onchange="swap(0)">1</option> <option value="hi2" onchange="swap(1)">2</option> <option value="hi3" onchange="swap(2)">3</option> <option value="hi4" onchange="swap(3)">4</option> <option value="hi5" onchange="swap(4)">5</option> </select> </td> </tr> <tr> <td colspan="5" align="center"> <input type="button" onclick="roll()" value="roll them"> <br> <textarea name="t" cols="40" rows="12" >History Of Roles</textarea> I have html like this Code: <form> <select name="otype[]" class="txtText" id="otype[]"> <option value="Processing">Processing</option> <option value="Shipped">Shipped</option> </select> some code...... <select name="otype[]" class="txtText" id="otype[]"> <option value="Processing">Processing</option> <option value="Shipped">Shipped</option> </select> some code....... <select name="otype[]" class="txtText" id="otype[]"> <option value="Processing">Processing</option> <option value="Shipped">Shipped</option> </select> I need to change all select lists options to "Shipped" if admin clicks on "Shipped" on top of the page and "Processing" if customer clicks on "Processing" link (<a href="javascript:select_processing()">Processing</a>) Can somebody help me in doing so? I couldn't think of a way to explain my idea thoroughly, but I'm learning javascript and I have an html <select> form selected by using getElementById. Now, how do I access the data within the option tags to write to a variable? I know there are many simple ways of making it so that the value of the options are the html color name rather than hex code, but I'm doing this to learn javascript. I have experience with ruby (ok, not THAT much, but I understand the concepts). Anyway's the code explains my problem much better, so here it is: Code: <body> <form action= ""> <fieldset> <select id="selColor"> <option value="FFFFFF">White</option> <option value="#A9A9A9">Gray</option> <option value="#000000">Black</option> <option value="#FF0000">Red</option> <option value="#FFA500">Orange</option> <option value="FFFF00">Yellow</option> <option value="#9ACD32">Green</option> <option value="#0000FF">Blue</option> <option value="#4B0082">Indigo</option> <option value="#9400D3">Violet</option> </select> <input type="button" value="Change Color" onclick="changeColor()" /> </fieldset> </form> <script type="text/javascript"> //<![CDATA[ function changeColor() { var selColor = document.getElementById("selColor") var color = selColor.value var colorid = if (confirm("would you like to change color to "+colorid+"?")) { document.body.style.backgroundColor = color } } //]]> </script> </body> I haven't initialized var colorid, but I'm trying to set it to either of the highlighted parts of the following piece of my code. <option id=" white " value="FFFFFF"> White </option> I want to access that part of the option tags of the element that the user selects. So, without changing the hex values to the color equivalent, how do I access the name of the selected option tag? ( I could make an if/switch statement to translate the hex color into a name and put it into the variable, but I would like to know how to do what I'm asking in case I run into a similair problem.) Hi Peers, i have a Drop down list with 10 choices (skillset). users must choose one skillset and the corresponding level (beginer/intermediate/master). ( they have to do this 10 times for all the sillsets) what i want is : 1 - i need to show up only one record (dropdowanlist) with level then have a button to add new skill and level if required 2- then when they choose the 1st skill from the dropdown , this one will not show up on the 2nd choice dropdown. is it possible any help ? thanks guys like for example i have text areas named upload1 and upload2 when I click or add input on upload1 a drop down list below upload2 will not change, but when I add input on upload2 the dropdown will select "parts" This might be a really stupid question. I'm new to javascript, and I'm wondering if it is possible to add a css class to a for Loop? Just so that I get this result without having to write every paragraph: <code> example { text-align:center; height:100cm; } </style> </head> <body> <p>0m</p> <p>1m</p> <p>2m</p> <p>3m</p> </body> </code> Hi guys i am newbie here. I would really appreciate some help. Here is the issue. I would like to implement jqtransform http://www.dfc-e.com/metiers/multime...e/jqtransform/ I cant seem to get it working. Here are my searchform files (searchform.tpl) and (searchform.php) SEARCHFORM.TPL Code: <style type="text/css"> <!-- #searchform .form-container form table tr td div table tr td .note span strong { font-family: Tahoma, Geneva, sans-serif; font-size: 12px; } .findbutton { } --> </style> <link href="../css.css" rel="stylesheet" type="text/css" /> <title>Oztradesman.com.au</title><div id="searchform"> <div class="form-container"> <form action="<?php echo BASE_URL; ?>/search_results.php" method="get"> <table width="946" height="290" align="center" cellspacing="5"> <tr> <td width="932" height="278" valign="top" style="padding-bottom: 15px; font-family: Tahoma, Geneva, sans-serif; font-size: 11px; font-weight: bold;"><div align="center"> <table width="694" height="262" align="left" cellspacing="2"> <tr> <td width="10"> </td> <td width="171"><img src="../../../Background.gif" alt="the best Tradesman in Australia" width="12" height="22" /><img src="../../../Background.gif" alt="the bestTradesman in Australia" width="12" height="2" /><img src="../../../Background.gif" alt="the best Tradesman in Australia" width="12" height="2" /><img src="../../../Background.gif" alt="the best Tradesman in Australia" width="12" height="2" /><img src="../../../Background.gif" alt="the best Tradesman in Australia" width="12" height="2" /><img src="../../../Background.gif" alt="the best Tradesman in Australia" width="12" height="2" /><img src="../../../Background.gif" alt="the best Tradesman in Australia" width="12" height="2" /><img src="../../../Background.gif" alt="the best Tradesman in Australia" width="12" height="2" /></td> <td width="40"><p align="left"><img src="../../../Background.gif" alt="Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder Builder" width="1" height="1" /></p> <p align="left"><img src="../../../Background.gif" alt="Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman Tradesman" width="1" height="1" /></p></td> <td width="20"></td> </tr> <tr> <td> </td> <td height="58"><img src="../../../Background.gif" alt="the bestTradesman in Australia" width="1" height="1" /></td> <td> </td> <td> </td> <td colspan="2"> </td> <td width="92"> </td> <td width="68"> </td> <td width="71"> </td> <td width="87"><p class="note"> </p> <p class="note"> </p></td> <td width="11"> </td> </tr> <tr> <td valign="top" nowrap="nowrap" style="padding-bottom: 15px; font-size: 15px;"> </td> <td height="47" valign="top" nowrap="nowrap" style="padding-bottom: 15px; font-size: 16px;"><p align="left" class="note"> </p> <p align="left" class="note"> </p> <p align="left" class="note"> </p> <p align="left" class="note"><strong>Select Trade</strong></p> <p align="left" class="note"><strong><strong><?php echo $form->getFieldHTML('category'); ?></strong></strong></p> <p align="left" class="note"> </p></td> <th valign="top" style="padding-bottom: 15px"><p align="left" class="note"><span style="padding-bottom: 15px; cursor: text;"> <p align="left" class="note"> <p align="left" class="note"> <p align="left" class="note"> <!-- <?php echo $form->getFieldHTML('location_id'); ?> --> <td valign="top" style="padding-bottom: 15px"><p align="left" class="note"> </p></td> <td width="65" height="47" valign="top" style="padding-bottom: 15px; font-size: 16px;"><p align="left" class="note"> </p> <p align="left" class="note"> </p> <p align="left" class="note"> </p> <p align="left" class="note"><strong>Location</strong></p><p align="left" class="note"><?php echo $form->getFieldHTML('zip'); ?></p> <p align="left" class="note"> </p></td> <td width="1" valign="top" nowrap="nowrap" style="padding-bottom: 15px; font-size: 15px;"> </td> <td height="47"><p> </p> <p align="left"> </p> <p align="left"> </p> <p align="left"> </p> <p align="left"> </p> <p align="left"> </p> <p align="right"><span class="note"><span style="padding-bottom: 15px;"><?php echo $form->getFieldHTML('zip_miles'); ?></span></span></p> <p align="center"><strong>Surrounding Areas</strong></p> <td valign="top" style="padding-bottom: 15px"><p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"><span style="padding-bottom: 15px;"> </span></p> </p></td> <td valign="top" style="padding-bottom: 15px"><p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"><span style="padding-bottom: 15px;"> <input name="input" type="image" class="button" title="Find Tradesman" value="Search" src="../../../The-Find-Search-button.png" alt="Find Tradesman builder plumber electrician painter" align="left" width="98" height="32" hspace="0" vspace="0" /> </span></p></td> <td valign="top" style="padding-bottom: 15px"><p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"> </p> <p class="note"> </p></td> <td> </td> <td width="6"> </td> </tr> <tr> <td valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td colspan="2" valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td></td> <td></td> </tr> <tr> <td valign="top" style="padding-bottom: 15px"> </td> <td height="48" valign="top" style="padding-bottom: 15px"><div align="left"></div></td> <td valign="top" style="padding-bottom: 15px; cursor: text;"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td colspan="2" valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td valign="top" style="padding-bottom: 15px"> </td> <td> </td> <td></td> </tr> </table> </div></td> </tr> </table> </form> </div> </div> <script type="text/javascript"><!-- document.getElementById('keyword').focus(); //--></script> SEARCHFORM.PHP Code: <?php if(!defined('IN_PMD')) exit(); $searchform = $PMDR->getNew('Template',PMDROOT.TEMPLATE_PATH.'blocks/search_form.tpl'); $search_form_object = $PMDR->getNew('Form'); $search_form_object->addField('keyword','text',array('label'=>$PMDR->getLanguage('public_general_search_find'),'fieldset'=>'search','value'=>$_GET['keyword'],'style'=>'width: 220px; height: 28px;','id'=>'searchfield')); $search_form_object->addField('category','select',array('label'=>$PMDR->getLanguage('public_general_search_category'),'fieldset'=>'search','value'=>$_GET['category'],'style'=>'width: 220px; height: 28px;','first_option'=>'','options'=>$db->GetAssoc("SELECT id, title FROM ".T_CATEGORIES." WHERE hidden=0 AND level=1 ORDER BY left_"),'class'=>'input_small')); $search_form_object->addField('location_id','select',array('label'=>$PMDR->getLanguage('public_general_search_location'),'fieldset'=>'search','value'=>$_GET['location_id'],'first_option'=>'','options'=>$db->GetAssoc("SELECT id, title FROM ".T_LOCATIONS." WHERE hidden=0 AND level=1 ORDER BY left_"),'class'=>'input_small')); $search_form_object->addField('location','text',array('label'=>$PMDR->getLanguage('public_general_search_location'),'fieldset'=>'search','value'=>$_GET['location'],'style'=>'width: 215px; border:#000 1px solid;','id'=>'searchfield')); $search_form_object->addField('zip','text',array('label'=>$PMDR->getLanguage('public_search_zip'),'fieldset'=>'search','style'=>'width: 215px; border:#000 1px solid;','id'=>'searchfield')); $search_form_object->addField('zip_miles','radio',array('label'=>$PMDR->getLanguage('public_general_search_within'),'fieldset'=>'search','value'=>$_GET['zip_miles'],'style'=>'width: 2cm;','id'=>'radiosearchbutton','options'=>array('25'=>''))); $search_form_object->addField('submit','submit',array('label'=>$PMDR->getLanguage('public_general_search_search'),'fieldset'=>'button')); $searchform->set('form',$search_form_object); unset($search_form_object); ?> Now i load the JQUERY.JS and JQTRANSFORM.JS files through the HEADER.PHP file. This is how it looks; HEADER.PHP Code: <?php $timing_start = explode(' ', microtime()); if($PMDR->get('header_file')) { $header = $PMDR->getNew('Template',PMDROOT.TEMPLATE_PATH.'/'.$PMDR->get('header_file')); } else { $header = $PMDR->getNew('Template',PMDROOT.TEMPLATE_PATH.'/header.tpl'); } // Check for maintenance option and show header message bar if necesarry if($PMDR->getConfig('maintenance') AND in_array('admin_login',$_SESSION['admin_permissions'])) { $header->set('maintenance',true); } if($PMDR->getConfig('usershare') == 'FacebookConnect') { $header->set('facebook',true); } if($PMDR->get('meta_description')) { $header->set('meta_description',strip_tags($PMDR->get('meta_description'))); } else { $header->set('meta_description',$PMDR->getConfig('meta_description_default')); } if($PMDR->get('meta_keywords')) { $header->set('meta_keywords',$PMDR->get('meta_keywords')); } else { $header->set('meta_keywords',$PMDR->getConfig('meta_keywords_default')); } if($PMDR->getConfig('search_display_all') OR on_page('index.php')) { $header->set('searchform',$searchform); $header->set('search_display_all',($PMDR->getConfig('search_display_all') OR on_page('index.php'))); } $PMDR->loadJavascript($PMDR->getConfig('head_javascript')); $PMDR->loadJavascript('<script type="text/javascript" src="'.BASE_URL.'/includes/javascript_global.js"></script>'); $PMDR->loadJavascript('<script type="text/javascript" src="'.BASE_URL.TEMPLATE_PATH.'javascript.js"></script>'); $PMDR->loadJavascript('<script type="text/javascript" src="'.BASE_URL.TEMPLATE_PATH.'jquery.js"></script>'); $PMDR->loadJavascript('<script type="text/javascript" src="'.BASE_URL.TEMPLATE_PATH.'jquery.jqtransform.js"></script>'); //if(is_object($xajax)) $javascript .= $xajax->getJavascript(BASE_URL.'/includes/xajax/'); $PMDR->setAdd('javascript_onload',' var headID = document.getElementsByTagName("head")[0]; if(headID) { var newScript = document.createElement(\'script\'); newScript.type = \'text/javascript\'; newScript.src = \''.BASE_URL.'/cron.php?type=javascript\'; headID.appendChild(newScript); } '); if($PMDR->get('javascript_onload')) { $onLoad = '<script language="javascript" type="text/javascript" charset="'.CHARSET.'">'; $onLoad .= "function onLoad() {\n"; $onLoad .= implode("\n",$PMDR->get('javascript_onload')); $onLoad .= "\n}"; $onLoad .= 'window.onload=onLoad;'."\n"; $onLoad .= '</script>'."\n"; $PMDR->loadJavascript($onLoad); unset($onLoad); } $javascript .= implode("\n",(array) $PMDR->get('load_javascript')); $header->set('load_javascript',$javascript); $header->set('load_css',implode("\n",(array) $PMDR->get('load_css'))); $header->set('css_file_path',BASE_URL.TEMPLATE_PATH.'css.css'); // Add title from configuration to end of array and display, seperated by a dash - //$PMDR->set('page_title',array_merge(array_reverse($PMDR->get('page_title')),array($PMDR->getConfig('title')))); $header->set('page_title',implode(' - ',array_merge(array_reverse($PMDR->get('page_title')),array($PMDR->getConfig('title'))))); if($PMDR->get('breadcrumb')) { $header->set('breadcrumb',$PMDR->get('breadcrumb')); } ?> This is all i have done other than the basic css which i didn't include so i don't make things more complicated. I would really appreciate some help on this. Regards, George Hello, Using Javascript, How would I go about apply the following code below as a style class (Error) to a single textbox? Here's what I have so far: Code: document.getElementById('T1').style.backgroundColor = 'FEF6F4' document.getElementById('T1').style.border = '1px solid #CD0A0A' Thanks. J |