JavaScript - How To Apply 'paragraph Styles' Into A Script? Need Help!
var myDoc = app.documents[0]
var mySel = app.selection[0] var myStory = mySel.parentStory; // Now we are pointing to the entire story var myHolidayStyle1 = "Holiday-Day_of_the_week" // Header 'day of the week' var myHolidayStyle2 = "Holiday-Month_and_date" // Header 'month and day' var myHolidayStyle3 = "Lead Paragraph" // Lead Paragraph 'default paragraph style' myStory.paragraphs[0].appliedParagraphStyle = myHolidayStyle1; //Header 'day of the week' and Month and day. myStory.paragraphs[1].appliedParagraphStyle = myHolidayStyle2; // Header 'month of the day' myStory.paragraphs[2].appliedParagraphStyle = myHolidayStyle3; // Lead Paragraph 'default paragraph style' //.appliedParagraphStyle = myDoc.paragraphStyles.item (myHolidayStyle1); //mySel.paragraphs[-1].insertionPoints[-1].paragraphs[0]; //Loops to change all the paragraphs to Paragraph body to ever paragraph (only problem is its limited to the entire page.) for (loop=0; loop<myStory.paragraphs.length; loop++) myStory.paragraphs[loop].appliedParagraphStyle = myHolidayStyle3; // Something simple to check if text 'drops out' of a certain text frame. currTextFrame = app.selection[0].parentTextFrames[0]; currPar = currTextFrame.paragraphs[0]; while (currPar && currPar.parentTextFrames[0] == currTextFrame) { currPar.appliedParagraphStyle = someStyle; currPar = currTextFrame.paragraphs.nextItem(currPar); } // Script for starting Spell Check var WshShell = app.menus.item(0); var WshShell2 = WshShell.submenus.item(1); var WshShell3 = WshShell2.submenus.item(1); var WshShell4 = WshShell3.menuItems.item(0); WshShell4.associatedMenuAction.invoke(); Would this work, do I got a pretty generalized idea of how it should be written. I want this script to apply data that comes in from a export that is imported into Indesign. Basically Holidaystyle1 and 2 are already preset in data from a program called Linear. But the day, month, and date, will change. So I hoping there is a way from the script above to make 1 and 2 be at the top of the page, and style 3 be the paragraph style that leads in the text until the next articles are reach that start with like say 'Friday' and 'November 12', and the routine repeats itself again, until there is no-more data. (**edit** Is there a way to tell the script to put a line break or empty line between Style 0 and style 1?) I hope this make sense. I would love for the script to do all the data at once, and at the end, I put a spell check function that checks to make sure the spelling and grammar are correct, before the script finally ends. Similar TutorialsWould this work? or do I got the wrong function commands? How would I alter this to make it work, been staring at the screen for 8 hours..... var myInDesign = app var myDocument = app.activeDocument var myDocName = myDocument.name app.findParagraphStyle.caseSensitive = false; app.findParagraphStyle.wholeWord = false; app.findCharacterStyle.wholeWord = false; app.findCharacterStyle.caseSensitive = false; app.findParagraphStyle.findWhat = "SN.outabout.DAY-Gray"; app.changeParagraphStyle.changeTo = "SN.Holiday-Day_of_the_week"; app.documents.item(0).changeParagraphStyle(); app.findParagraphStyle.findWhat = "SN.outabout.DATE"; app.changeParagraphStyle.changeTo = "SN.Holiday-Month_and_Day"; app.documents.item(0).changeParagraphStyle(); app.findParagraphStyle.findWhat = "SN.listingsLT"; app.changeParagraphStyle.changeTo = "SN.Holiday-Paragraph"; app.documents.item(0).changeParagraphStyle(); app.findCharacterStyle.findWhat = "SN.listingsBOLD"; app.changeCharacterStyle.changeTo = "SN.Holiday-Title_Paragraph"; app.documents.item(0).changeCharacterStyle(); //myInCopy = CreateObject("InCopy.Application.CS3") //Not sure if this would work, just crafting idea's. //var myDocument = myInCopy.ActiveDocument //var mySelection = myInCopy.Selection.Item(1) //var myStory = MySelection.ParentStory //var myText = myStory.Paragraphs.Item(1) //myStory.CheckOut //myText.ApplyParagraphStyle myDocument.ParagraphStyles.Item("zAPPROVED"), True //myStory.CheckIn Can I just do this with like a Nested If, then Statement? Hi coders, I have a form where customers can register thierselves by entering the relevant fields. There is a control() javascript which ckecks if everything on the form is ok before submitting it. Althugh IE applies the script for its every check, Firefox only applies the first check (first if statement) of the script. The rest is ignored. Here is the javascript code: Code: function control() { if (document.member.FirstName.value == ""){ document.member.FirstName.focus(); alert("Please fill the name field"); return false; } if (document.member.FirstName.value.length<2) { alert("Name field cannot be shorter than 2 characters."); document.member.FirstName.focus(); return false; } if (/[\d]/.test(document.getElementById("FirstName").value)) { alert("Entered numbers into the Name field"); return false; } if (document.member.LastName.value == ""){ document.member.LastName.focus(); alert("Please fill the Lastname field"); return false; } if (document.member.LastName.value.length<2) { alert("Lastname field cannot be shorter than 2 charcters. Please check again."); document.member.LastName.focus(); return false; } if (/[\d]/.test(document.getElementById("LastName").value)) { alert("Entered numbers into the Lastname field"); return false; } if (document.member.Address1.value.length<10) { alert("Address field contains less than 2 characters."); document.member.Address1.focus(); return false; } if (document.member.Username.value == ""){ document.member.Username.focus(); alert("Username field cannot be blank"); return false; } if (document.member.Address1.value == ""){ document.member.Address1.focus(); alert("Address field cannot be blank "); return false; } if (document.member.City.value == ""){ document.member.City.focus(); alert("City field cannot be blank"); return false; } if (document.member.Email.value == ""){ document.member.Email.focus(); alert("E-Mail field cannot be blank."); return false; } if (echeck(document.member.Email.value)==false){ document.member.Email.focus(); return false; } if (document.member.PhoneNumber.value == ""){ document.member.PhoneNumber.focus(); alert("Phone number field cannot be blank"); return false; } if (!/^\d*$/.test(document.getElementById("PhoneNumber").value)) { alert("Entered characters into the Phone Number field"); return false; } if (document.member.Pass.value == ""){ document.member.Pass.focus(); alert("Password field cannot be blank."); return false; } if (document.member.Pass2.value == ""){ document.member.Pass2.focus(); alert("Password confirmation field cannot be blank."); return false; } if (document.forms[0].Pass.value.length<6) { alert("Password field cannot contain less than 6 characters. Please check"); document.member.Pass.focus(); return false; } if (document.member.Pass.value != document.member.Pass2.value) { alert("Password and password confirmation fields are not identical. Please check "); document.member.Pass.focus(); return false; } if (!isTelNum(document.forms[0].PhoneNumber,'Telefon ')) return false; if (!isNum(document.forms[0].InternalPhoneNumber,'Internal Phone number')) return false; //if (!isValidEmail(document.forms[0].Email)) return false; return true; } Well its interesting that only the first check is taken into consideration. if (document.member.FirstName.value == ""){ The rest is not even seen. Even if you do not fill the rest of the form, the submit button tries to submit the form regardless what more needs to be checked. Here is the submit button: Code: <input type="submit" name="member" value="Register Me" id="member" onclick="return control()";> Any observations and comments are appreciated. Hey guys, so i have a table, and it displays 6 rows, and the content inside of those rows. But i need to make it so that the middle row, has a border so it appears it is highlighted. Here is what i have Code: function timer() { time=parseInt(player.getCurrentTime()) if (time%5==0&&oldtime!=time){ rows[1].innerHTML=rows[(time/5)+ -1].innerHTML rows[2].innerHTML=rows[(time/5)+ 0].innerHTML rows[3].innerHTML=rows[(time/5)+ 1].innerHTML rows[4].innerHTML=rows[(time/5)+ 2].innerHTML rows[5].innerHTML=rows[(time/5)+ 3].innerHTML oldtime=time } } Hi, I'm a javascript idiot, and I need a script to change two styles in two different elements based on the status of 2 radio buttons. Basically, I have 2 forms...#formTest and #formTest2. When radio button "search" value "1" is selected I need the display style for #formTest to be "block" and the display style for #formTest2 to be "none". When radio buton "search" value "2" is selected, I need the opposite to occur. (#formTest display style ="none" and #formTest2 display style="block") I have very buggy code which produces similar changes, but does other bad things, so won't work. Basically, the first selection change displays both forms, which after the first selection change works fine, unless you click anywhere else, in which case both forms are not displayed. I know I should use a function in the head and call it with an onselect or onclick event. I just don't know how. I appreciate any help anyone can offer me! My ugly (nonfunctional code is below) Search by Make: <input name="search" type="radio" value="1" onclick="document.getElementById('testForm').style.display='block';" onchange="document.getElementById('testForm').style.display='none';" checked="checked" /> <br /> Search by Category: <input name="search" type="radio" value="2" onclick="document.getElementById('testForm2').style.display='block';" onchange="document.getElementById('testForm2').style.display='none';" /> Thanks Again I have a form where I want certain fields to be visible only if the user clicks a checkbox on the form. Specifically, when Presented_to_Goverment_EntityCheckbox0 is checked, these fields should appear. Code: DropDownList ID="GovEntity" Officials_Last_NameTextBox0 Officials_First_NameTextBox0 Officials_TitleTextBox0 I created two different styles, show below; one makes the fields visible and one hides them Code: <style type="text/css"> .hideit { visibility: hidden; overflow: hidden; position: absolute; } .showit { visibility: visible; overflow: visible; position: static; } </style> Then I surrounded the fields with a div ID'ed as wdiv Code: <div class="hideit" id="wdiv"> Type Government Entity: <asp:TextBox ID="Type_Government_EntityTextBox" runat="server" Text='<%# Bind("Type_Government_Entity") %>' /> <br /> Officials Last Name: <asp:TextBox ID="Officials_Last_NameTextBox" runat="server" style="display:none" Text='<%# Bind("Officials_Last_Name") %>' /> <br /> Officials_First_Name: <asp:TextBox ID="Officials_First_NameTextBox" runat="server" Text='<%# Bind("Officials_First_Name") %>' /> <br /> Officials_Title: <asp:TextBox ID="Officials_TitleTextBox" runat="server" Text='<%# Bind("Officials_Title") %>' /> <br /> </div> I am using the following javascript to change the styles in response to an onclick event. Code: <script language="javascript" type="text/javascript"> function changeDiv(wdiv) { thediv = document.getElementById(wdiv); if(thediv.className == 'hideit'){ thediv.className = 'showit'; } else if (thediv.className == 'showit'){ thediv.className = 'showit'; }} </script> I call the Javascript in this line Code: <asp:CheckBox ID="Presented_to_Goverment_EntityCheckBox" onClick="ChangeDiv(wdiv)" runat="server" /> <br /> However nothing happens when I click the checkbox and if I look in Firefox's error console it says ChangeDiv is not defined. Thanks. How do I swap these two paragraphs at will by clicking the buttons? Demo at: http://aapress.com.au/demo/paragraphswap/demo.html At present, for some reason, clicking button 2 makes both paragraphs appear. The effect I am after is to toggle individual paragraphs on and off, with the option of displaying both at once. Code: <html> <head> <title>Paragraph swap</title> <script> with (document) { write("<STYLE TYPE='text/css'>"); write(".hiddentext {display:none;} .outline {cursor: hand; text-decoration:underline; font-family: Arial; font-size: 13px;}"); write("</STYLE>"); } function expandIt(whichEl) { whichEl.style.display = (whichEl.style.display == "block" ) ? "none" : "block"; } </script> </head> <body> <div align="center"> <center> <table border="1" cellpadding="10" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td bgcolor="#FFFF55" valign="top"> <div align="center"> <center> <table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" bordercolor="#000000"> <tr> <td width="100%" colspan="2"> </td> </tr> <tr> <td width="40%"> </td> <td width="60%"> <p onclick="expandIt(el1); return false;"> <img border="1" src="1.gif" width="23" height="15"> Click buttons <span onclick="expandIt(el2); return false"> <img border="1" src="2.gif" width="23" height="15"></a></p> </span></td> </tr> <tr> <td colspan="2"><br> <div id="el1" class="hiddentext"> <div align="center"> <table border="0" cellpadding="10" style="border-collapse: collapse" width="65%" bordercolor="#000000" bgcolor="#CCFFFF"> <tr> <td> <div align="center"> <table border="0" cellpadding="3" style="border-collapse: collapse" width="100%"> <tr> <td valign="top">PARAGRAPH 1</td> </tr> </table> </div> </td> </tr> </table> <br> <div id="el2" class="hiddentext"> <div align="center"> <table border="0" cellpadding="10" style="border-collapse: collapse" width="65%" bordercolor="#000000" bgcolor="#FFCCCC"> <tr> <td> <div align="center"> <table border="0" cellpadding="3" style="border-collapse: collapse" width="100%" bordercolor="#000000"> <tr> <td valign="top">PARAGRAPH 2</td> </tr> </table> </div> </td> </tr> </table> </div> </div> </div> </div> </td> </tr> </table> <br> </center></div> </td> </tr> </table> </center></div> </body> </html> Quote: Traversal also aids developers in affecting the elements immediately surrounding an element that is being manipulated or otherwise utilized by a script. This can range from adding a class to parent elements to indicate activity to disabling all inactive form elements to any number of other useful tasks. can't understand the above,the paragraph is from a book.what the author want to tell.anyone helps.thank you, I'm trying to add some css tags (<strong>, <em> etc) to an entire paragraph <p> that contains a custom word, for example a paragraph like this <p>Title:....</p> This could be easily done for the custom word only with a var.str and document write. I would be grateful if you could post the entire code. 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> Is there a script that automatically applies two different styles to the first two lines of text in a container, without using CSS? Example: ====== This Would be Line One as a Title with its Own Style This would be line two as a byline with a separate style This is the main text of the paragraph... etc etc. ====== Thanks for any help. Steph 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 Hi, I'm just trying to use a JavaScript form element handler to apply a CSS gradient background dynamically. It doesn't work in IE, but does in the other browsers I've tried. Thaks for any help with it! Jennifer Here's my function Code: function swapGradButton() { g1 = document.getElementById('ButtonGrad1Color'); g2 = document.getElementById('ButtonGrad2Color'); txt = document.getElementById('ButtonTextColor'); document.getElementById('GradButton').style.color = txt.value; if (document.getElementById('GradButton').filters && document.getElementById('GradButton').filters.length>0) { document.getElementById('GradButton').filter = "progid:DXImageTransform.Microsoft.gradient(startColorstr='"+g1.value+"', endColorstr='"+g2.value+"')"; } else { document.getElementById('GradButton').style.background = "-webkit-gradient(linear, left top, left bottom, from("+g1.value+"), to("+g2.value+"))"; document.getElementById('GradButton').style.background = "-moz-linear-gradient(top, "+g1.value+", "+g2.value+")"; } } 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 everyone Background I have an electronics site on which I have a code generator. Im an stuck on how to acheive something. I will simplify what I want to do, so I can then adapt it to my code. I have a paragraph of text on the web page, on which I want to change some words with in the paragraph depending on 2 radio buttons. Example (radio buttons & short paragraph): (Radio Button) Apples (checked) (Radio Button) Bananas "Welcome to jakes fruit shop. You have selected apples today" (apples being the word that would change if the banana radio button is checked) Here is the code generator if your interested. http://www.jakeselectronics.net/conf...erator877A.php What I actually want to do is put other 'fixed' text in the input text area (near botton of page) with only the config line changing. And If I can be shown how to do the short example above, i think I will be able to edit my generator and get it to do what i want it to do. 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!! 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> Is there any way that I can have multiple textboxes where the user can enter text (such as "black or green") and it would edit a css file, like this: Code: <style> body{ background-color:INPUT; } </style> <input type="text" name="bg"/> ? I have my code set up so whenever I hover over a picture it changes the background image and I want it so that when I leave the picture the background changes back to a black background but the background just stays as the image. I cant find out why its not changing back when I leave, it looks like everything should work. Code: var bgImage = new Array() bgImage[0] = "url(../Pictures/RM/Iker.jpg)"; bgImage[1] = "url(../Pictures/RM/Arbeloa.jpg)"; parseInt(event.clientX) - parseInt(movingDiv.style.left) function into(whoseCalling) { num =(document.getElementById(whoseCalling).id).substr(3); document.getElementById(whoseCalling).style.borderStyle = "double"; document.getElementById(whoseCalling).style.borderTopColor = "blue"; document.getElementById(whoseCalling).style.borderBottomColor = "red"; document.getElementById(whoseCalling).style.borderLeftColor = "yellow"; document.getElementById(whoseCalling).style.borderRightColor = "green"; document.getElementById(whoseCalling).style.borderWidth = "8px"; for (i=0; i<30; i++) { document.getElementById("img" + i).style.opacity = ".1"; } document.getElementById(whoseCalling).style.opacity = "1"; document.body.style.backgroundImage = bgImage[num] } function out(whoseCalling) { document.getElementById(whoseCalling).style.borderStyle = "solid"; document.getElementById(whoseCalling).style.borderColor = "red"; document.getElementById(whoseCalling).style.borderWidth = "3px"; document.body.style.backgroundColor = "black"; for (i=0; i<30; i++) { document.getElementById("img" + i).style.opacity = "1"; } } I would like to have a text link do 2 things: 1. Change #box1.style1 to class="style2" (from style1) 2. Change #box2.style2 to class="style1" (from style2) So the text link would not change its own style, but change the class of 2 different divs Your help on this is very much appreciated. Thank you hopefully this is what I need to fix a problem with my code too. I have a JS that resizes a few div widths on my page but when i also have the styles in a seperate file the JS does not work. this is my original code that works when i use the following line in my html. Code: function Div(id,hw,ud) { var div=document.getElementById(id); if (hw == "h"){ var h=parseInt(div.style.height)+ud; if (h>=150){ div.style.height = h + "px"; //alert(hw + h); } } else if (hw == "w"){ var w=parseInt(div.style.width)+ud; if (w>=150){ div.style.width = w + "px"; var inputdiv=document.getElementById('txt_message'); var inputw=parseInt(inputdiv.style.width)+ud; inputdiv.style.width = inputw + "px"; } } var chat_div = document.getElementById('div_chat'); chat_div.scrollTop = chat_div.scrollHeight; } Code: <div id="div_chat" style="height: 300px; width: 500px; overflow: auto; background-color: #CCCCCC; border: 1px solid #555555;"></div> if i was to use the following instead Code: <div id="div_chat"></div> with Code: #div_chat { height: 300px; width: 500px; overflow: auto; background-color: #CCCCCC; border: 1px solid #555555; } in my CSS file then the JS is fired (i added an alert() to my code to check this) but the widths are not changed. what changes should i make to my codes to make this work so i can have the styles in my CSS file instead of the main HTML file. edit: just thought you may need this part too so you can see what the call looks like. Code: <div> resize chat log <img src="resize_d.gif" width="21" height="9" onclick="Div('div_chat','h',20);" alt="height +"> <img src="resize_u.gif" width="21" height="9" onclick="Div('div_chat','h',-20);" alt="height -"> <img src="resize_r.gif" width="21" height="9" onclick="Div('div_chat','w',20);" alt="width +"> <img src="resize_l.gif" width="21" height="9" onclick="Div('div_chat','w',-20);" alt="height -"> </div> further edit: i have just tried the following JS but this time i get the following error... Webpage error details Message: Invalid procedure call or argument on the following line Code: div.currentStyle["width"] = w + "px"; |